From d148b2742677027cbd31162b45abb1aa19583da4 Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 5 May 2022 11:49:04 -0300 Subject: [PATCH] contourline: Make line size configurable --- arts/contourline.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arts/contourline.go b/arts/contourline.go index d831353..402ee31 100644 --- a/arts/contourline.go +++ b/arts/contourline.go @@ -1,21 +1,24 @@ package arts import ( + "math" + "math/rand" + "github.com/fogleman/gg" "github.com/jdxyw/generativeart" "github.com/jdxyw/generativeart/common" - "math" - "math/rand" ) type contourLine struct { - lineNum int + lineNum int + lineSize float64 } // NewContourLine returns a contourLine object. -func NewContourLine(lineNum int) *contourLine { +func NewContourLine(lineNum int, lineSize float64) *contourLine { return &contourLine{ - lineNum: lineNum, + lineNum: lineNum, + lineSize: lineSize, } } @@ -35,7 +38,7 @@ func (cl *contourLine) Generative(c *generativeart.Canva) { y += math.Sin(theta) * 0.4 ctex.SetColor(cls) - ctex.DrawEllipse(x, y, 2, 2) + ctex.DrawEllipse(x, y, cl.lineSize, cl.lineSize) ctex.Fill() if x > float64(c.Width()) || x < 0 || y > float64(c.Height()) || y < 0 || rand.Float64() < 0.001 {