-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoContourBlend01.kt
37 lines (34 loc) · 1.04 KB
/
DemoContourBlend01.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
29
30
31
32
33
34
35
36
37
package blend
import org.openrndr.application
import org.openrndr.draw.isolated
import org.openrndr.extra.shapes.blend.blend
import org.openrndr.extra.shapes.primitives.grid
import org.openrndr.extra.shapes.primitives.regularStar
import org.openrndr.math.Vector2
import org.openrndr.shape.Circle
import kotlin.math.PI
import kotlin.math.cos
/**
* Demonstration of uniform contour blending
*/
fun main() {
application {
configure {
width = 720
height = 720
}
program {
val a = Circle(Vector2.ZERO, 90.0).contour
val b = regularStar(5, 30.0, 90.0, center = Vector2.ZERO, phase = 180.0)
val blend = a.blend(b)
extend {
drawer.bounds.grid(3, 3).flatten().forEachIndexed { index, it ->
drawer.isolated {
drawer.translate(it.center)
drawer.contour(blend.mix(cos(index * PI * 2.0 / 9.0 + seconds) * 0.5 + 0.5))
}
}
}
}
}
}