Files
orx/orx-shapes/src/jvmDemo/kotlin/primitives/DemoRectangleGrid01.kt
Abe Pazos c8f7dd52c6 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
2025-01-26 20:57:04 +01:00

27 lines
759 B
Kotlin

package primitives
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.shapes.primitives.grid
fun main() = application {
configure {
width = 800
height = 800
}
program {
extend {
drawer.fill = ColorRGBa.WHITE.opacify(0.25)
drawer.stroke = ColorRGBa.PINK
// Notice the negative gutter in this grid. It creates an
// overlap between the resulting rectangles.
val grid = drawer.bounds.grid(8, 4, 20.0, 20.0, -20.0, -20.0)
for (cell in grid.flatten()) {
drawer.rectangle(cell)
drawer.lineSegment(cell.position(0.0, 0.0), cell.position(1.0, 1.0))
}
}
}
}