From 966671b688e1ef8b9871e4839a98b95845a97404 Mon Sep 17 00:00:00 2001 From: Yongwei Xing Date: Wed, 3 Mar 2021 16:12:50 +0800 Subject: [PATCH] add circle loop --- circleloop.go | 39 +++++++++++++++++++++++++++++++++++ example/example_circleloop.go | 20 ++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 circleloop.go create mode 100644 example/example_circleloop.go diff --git a/circleloop.go b/circleloop.go new file mode 100644 index 0000000..e2048c0 --- /dev/null +++ b/circleloop.go @@ -0,0 +1,39 @@ +package generativeart + +import ( + "github.com/fogleman/gg" + "math" +) + +type circleLoop struct { + radius float64 +} + +func NewCircleLoop(radius float64) *circleLoop { + return &circleLoop{ + radius: radius, + } +} + +// Generative draws a Circle Loop images. +func (cl *circleLoop) Generative(c *canva) { + ctex := gg.NewContextForRGBA(c.img) + + r := cl.radius + var theta float64 = 0 + for i:=0; i