forked from openrndr/orx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoScatter01.kt
28 lines (26 loc) · 874 Bytes
/
DemoScatter01.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.noise.scatter
import org.openrndr.math.Vector2
import org.openrndr.shape.Ellipse
import kotlin.math.cos
import kotlin.random.Random
fun main() {
application {
program {
extend {
val shape = Ellipse(Vector2(width/2.0, height/2.0), 200.0, 150.0 + cos(seconds)*125.0).shape
val points = shape.scatter(20.0, random = Random(0))
drawer.clear(ColorRGBa.BLACK)
drawer.stroke = null
drawer.fill = ColorRGBa.PINK
drawer.circles(points, 4.0)
if (seconds.mod(2.0) < 1.0) {
drawer.stroke = ColorRGBa.PINK
drawer.fill = null
drawer.shape(shape)
}
}
}
}
}