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

@@ -15,44 +15,42 @@ import org.openrndr.shape.ShapeContour
* In this case the contours are regular stars and the bezier patch
* is created using a circular contour with the required 4 segments.
*/
fun main() {
application {
configure {
width = 800
height = 800
}
program {
val bp = bezierPatch(
Circle(width / 2.0, height / 2.0, 350.0).contour
)
val star = regularStarRounded(
7, 30.0, 40.0,
0.5, 0.5
)
fun main() = application {
configure {
width = 800
height = 800
}
program {
val bp = bezierPatch(
Circle(width / 2.0, height / 2.0, 350.0).contour
)
val star = regularStarRounded(
7, 30.0, 40.0,
0.5, 0.5
)
extend {
drawer.clear(ColorRGBa.PINK)
extend {
drawer.clear(ColorRGBa.PINK)
// draw grid
for (i in 0..50) {
drawer.stroke = ColorRGBa.BLACK
drawer.contour(bp.horizontal(i / 50.0))
drawer.contour(bp.vertical(i / 50.0))
}
// draw grid
for (i in 0..50) {
drawer.stroke = ColorRGBa.BLACK
drawer.contour(bp.horizontal(i / 50.0))
drawer.contour(bp.vertical(i / 50.0))
}
// draw stars
drawer.fill = ColorRGBa.PINK
for (j in 1 until 10) {
for (i in 1 until 10) {
val starMoved = star.transform(
transform {
translate(j * width / 10.0, i * height / 10.0)
}
)
drawer.contour(bp.distort(starMoved, drawer.bounds))
}
// draw stars
drawer.fill = ColorRGBa.PINK
for (j in 1 until 10) {
for (i in 1 until 10) {
val starMoved = star.transform(
transform {
translate(j * width / 10.0, i * height / 10.0)
}
)
drawer.contour(bp.distort(starMoved, drawer.bounds))
}
}
}
}
}
}