-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoTunniPoint01.kt
33 lines (29 loc) · 1.08 KB
/
DemoTunniPoint01.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
package tunni
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.shapes.tunni.tunniLine
import org.openrndr.extra.shapes.tunni.tunniPoint
import org.openrndr.extra.shapes.tunni.withTunniLine
import org.openrndr.shape.Circle
import kotlin.math.cos
fun main() {
application {
program {
extend {
drawer.clear(ColorRGBa.WHITE)
drawer.fill = ColorRGBa.BLACK
val c = Circle(drawer.bounds.center, 200.0).contour
drawer.fill = null
for (s in c.segments) {
val tp = s.tunniPoint
drawer.circle(tp, 10.0)
val sc = s.cubic
drawer.lineSegment(sc.control[0], sc.control[1])
//drawer.segment(s.withTunniPoint(tp + (mouse.position - drawer.bounds.center)/2.0))
drawer.segment(s.withTunniLine(s.tunniLine.position(0.5) + s.tunniLine.normal * cos(seconds) * 40.0))
}
drawer.contour(c)
}
}
}
}