Demos: ensure all use fun main() = application {

- Adjust some demo window sizes.
- Replace Random.double by Double.uniform
- Tweak some demos so screenshots look more interesting
This commit is contained in:
Abe Pazos
2025-01-26 20:57:04 +01:00
parent 1975a820fc
commit c8f7dd52c6
116 changed files with 2889 additions and 2942 deletions

View File

@@ -8,33 +8,31 @@ import org.openrndr.extra.gui.GUI
import org.openrndr.extra.parameters.DoubleParameter
import org.openrndr.math.Vector2
fun main() {
application {
program {
val gui = GUI()
fun main() = application {
program {
val gui = GUI()
val state = object {
@DoubleParameter("radius", 0.0, 200.0)
var radius = 100.0
val state = object {
@DoubleParameter("radius", 0.0, 200.0)
var radius = 100.0
val difference by differencing(::radius)
val differenceHistory by tracking(::difference)
val differenceMax by aggregating(::differenceHistory) {
it.maxMag()
}
}
gui.add(state, "state")
extend(gui)
extend {
drawer.circle(drawer.bounds.center, state.radius)
drawer.stroke = ColorRGBa.GREEN
drawer.lineSegment(drawer.bounds.center, drawer.bounds.center + Vector2(state.difference, 0.0))
drawer.translate(0.0, 4.0)
drawer.stroke = ColorRGBa.BLUE
drawer.lineSegment(drawer.bounds.center, drawer.bounds.center + Vector2(state.differenceMax, 0.0))
val difference by differencing(::radius)
val differenceHistory by tracking(::difference)
val differenceMax by aggregating(::differenceHistory) {
it.maxMag()
}
}
gui.add(state, "state")
extend(gui)
extend {
drawer.circle(drawer.bounds.center, state.radius)
drawer.stroke = ColorRGBa.GREEN
drawer.lineSegment(drawer.bounds.center, drawer.bounds.center + Vector2(state.difference, 0.0))
drawer.translate(0.0, 4.0)
drawer.stroke = ColorRGBa.BLUE
drawer.lineSegment(drawer.bounds.center, drawer.bounds.center + Vector2(state.differenceMax, 0.0))
}
}
}
}