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:
@@ -6,35 +6,33 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.turtle.turtle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
// turtle returns List<ShapeContour>
|
||||
val contours = turtle(drawer.bounds.center) {
|
||||
penUp()
|
||||
forward(50.0)
|
||||
rotate(90.0)
|
||||
forward(50.0)
|
||||
penDown()
|
||||
fun main() = application {
|
||||
program {
|
||||
// turtle returns List<ShapeContour>
|
||||
val contours = turtle(drawer.bounds.center) {
|
||||
penUp()
|
||||
forward(50.0)
|
||||
rotate(90.0)
|
||||
forward(50.0)
|
||||
penDown()
|
||||
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
}
|
||||
rotate(90.0)
|
||||
forward(100.0)
|
||||
}
|
||||
|
||||
extend {
|
||||
// draw the contours
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(contours)
|
||||
}
|
||||
extend {
|
||||
// draw the contours
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(contours)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,18 @@ import org.openrndr.extra.turtle.turtle
|
||||
import org.openrndr.math.Vector2
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val r = Random(40)
|
||||
val contours = turtle(drawer.bounds.center + Vector2(-50.0, 50.0)) {
|
||||
for (i in 0 until 500) {
|
||||
rotate(Double.uniform(-90.0, 90.0, r))
|
||||
forward(Double.uniform(10.0, 40.0, r))
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(contours)
|
||||
fun main() = application {
|
||||
program {
|
||||
val r = Random(40)
|
||||
val contours = turtle(drawer.bounds.center + Vector2(-50.0, 50.0)) {
|
||||
for (i in 0 until 500) {
|
||||
rotate(Double.uniform(-90.0, 90.0, r))
|
||||
forward(Double.uniform(10.0, 40.0, r))
|
||||
}
|
||||
}
|
||||
extend {
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(contours)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,30 +8,28 @@ import org.openrndr.extra.turtle.turtle
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
// turtle returns List<ShapeContour>
|
||||
val contours = turtle(drawer.bounds.center + Vector2(-100.0, 100.0)) {
|
||||
forward(100.0)
|
||||
fun main() = application {
|
||||
program {
|
||||
// turtle returns List<ShapeContour>
|
||||
val contours = turtle(drawer.bounds.center + Vector2(-100.0, 100.0)) {
|
||||
forward(100.0)
|
||||
|
||||
// let the turtle draw a full a circle
|
||||
val circle0 = Circle(Vector2.ZERO, 100.0)
|
||||
contour(circle0.contour)
|
||||
// let the turtle draw a full a circle
|
||||
val circle0 = Circle(Vector2.ZERO, 100.0)
|
||||
contour(circle0.contour)
|
||||
|
||||
// let the turtle draw a half circle
|
||||
val circle1 = Circle(Vector2.ZERO, 50.0)
|
||||
contour(circle1.contour.sub(0.0, 0.5))
|
||||
// let the turtle draw a half circle
|
||||
val circle1 = Circle(Vector2.ZERO, 50.0)
|
||||
contour(circle1.contour.sub(0.0, 0.5))
|
||||
|
||||
// let the turtle draw another half circle
|
||||
val circle2 = Circle(Vector2.ZERO, 25.0)
|
||||
contour(circle2.contour.sub(0.0, 0.5))
|
||||
}
|
||||
extend {
|
||||
// draw the contours
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(contours)
|
||||
}
|
||||
// let the turtle draw another half circle
|
||||
val circle2 = Circle(Vector2.ZERO, 25.0)
|
||||
contour(circle2.contour.sub(0.0, 0.5))
|
||||
}
|
||||
extend {
|
||||
// draw the contours
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
drawer.contours(contours)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user