-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDemoSideCanvas01.kt
48 lines (40 loc) · 1.31 KB
/
DemoSideCanvas01.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
38
39
40
41
42
43
44
45
46
47
48
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.gui.GUI
import org.openrndr.extra.gui.GUIAppearance
import org.openrndr.extra.parameters.*
import org.openrndr.math.Vector2
import org.openrndr.panel.elements.draw
/**
* A simple demonstration of a GUI for drawing some circles
*/
fun main() = application {
configure {
width = 800
height = 800
windowResizable = true
}
program {
val gui = GUI(GUIAppearance(baseColor = ColorRGBa.GRAY.shade(0.25)))
gui.compartmentsCollapsedByDefault = false
gui.enableSideCanvas = true
val settings = @Description("Settings") object {
@DoubleParameter("radius", 0.0, 100.0)
var radius = 50.0
@Vector2Parameter("position", 0.0, 1.0)
var position = Vector2(0.6, 0.5)
@ColorParameter("color")
var color = ColorRGBa.PINK
@DoubleListParameter("radii", 5.0, 30.0)
var radii = mutableListOf(5.0, 6.0, 8.0, 14.0, 20.0, 30.0)
}
gui.add(settings)
extend(gui)
gui.canvas?.draw {
val width = drawer.width
val height = drawer.height
drawer.fill = settings.color
drawer.circle(width/2.0, height/2.0, 100.0)
}
}
}