import io.data2viz.color.*
import io.data2viz.geom.*
import io.data2viz.math.*
import io.data2viz.viz.*
fun main() {
viz {
size = size(600, 600) //<- you need a viz size
var pos: Pair<Double, Double> = Pair(-25.0, 25.0)
(0..15).forEach {
path {
pos = pos.next()
moveTo(pos.first, pos.second)
arc(pos.first, pos.second, 25.0, .0, it * (2 * PI / 8.0), false)
closePath()
fill = Colors.Web.grey
strokeColor = null
}
}
}.bindRendererOnNewCanvas()
}
private fun Pair<Double, Double>.next(): Pair<Double, Double> {
var x = first
var y = second
if (x >= 350) {
x = 25.0
y += 50.0
} else x += 50.0
return Pair(x, y)
}
comments