contourline: Make line size configurable

This commit is contained in:
Cat /dev/Nulo 2022-05-05 11:49:04 -03:00
parent 50049f1530
commit d148b27426
1 changed files with 9 additions and 6 deletions

View File

@ -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 {