From 983f40d21b3cd83976d1b6f1d9f34f14bd8b53aa Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Thu, 14 May 2020 19:23:25 +0200 Subject: [PATCH] Add DemoSimplex01.kt --- orx-noise/src/demo/kotlin/DemoSimplex01.kt | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 orx-noise/src/demo/kotlin/DemoSimplex01.kt diff --git a/orx-noise/src/demo/kotlin/DemoSimplex01.kt b/orx-noise/src/demo/kotlin/DemoSimplex01.kt new file mode 100644 index 00000000..e45b8ed0 --- /dev/null +++ b/orx-noise/src/demo/kotlin/DemoSimplex01.kt @@ -0,0 +1,40 @@ +import org.openrndr.application +import org.openrndr.color.ColorRGBa +import org.openrndr.draw.LineJoin +import org.openrndr.extensions.SingleScreenshot +import org.openrndr.extra.noise.simplex +import org.openrndr.shape.contour + +fun main() = application { + configure { + width = 720 + height = 720 + } + program { + if (System.getProperty("takeScreenshot") == "true") { + extend(SingleScreenshot()) { + this.outputFile = System.getProperty("screenshotPath") + } + } + extend { + drawer.stroke = null + drawer.fill = ColorRGBa.PINK + drawer.lineJoin = LineJoin.ROUND + for (y in 0..height step 20) { + val c = contour { + moveTo(0.0, 0.0) + for (x in 0..width step 40) { + val cx = simplex(y, x * 0.1 + seconds) * 10.0 + x + val cy = simplex(y + 3000, x * 0.1 + seconds) * 20.0 + val px = simplex(y + 8000, x * 0.1 + seconds) * 10.0 + x + val py = simplex(y + 6000, x * 0.1 + seconds) * 20.0 + continueTo(cx, cy, px, py) + } + } + val points = c.equidistantPositions(50) + drawer.circles(points, 10.0) + drawer.translate(0.0, 20.0) + } + } + } +} \ No newline at end of file