Code Sketch
Trigonometric Flower
Category: Art
cleari
def petal = Picture.fromVertexShape { s =>
s.beginShape()
for {
angle <- rangeTo(0.0, 360.0, 0.001).map(_.toDouble)
x = 200 * Math.cos(angle.toRadians)
y = 200 * Math.cos(angle.toRadians) * Math.sin(angle.toRadians)
_ = s.vertex(x, y)
} yield{}
s.endShape()
}
picStack(
petal.thatsFilledWith(randomColor),
petal.thatsRotated(90).thatsFilledWith(randomColor),
picStack(
petal.thatsFilledWith(randomColor),
petal.thatsFilledWith(randomColor).thatsRotated(90)
).thatsRotated(45).withOpacity(0.5)
).draw