From ca53dfe9028568adfe269a8ccd7d06baa9c61c5f Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Thu, 14 May 2020 10:11:38 +0200 Subject: [PATCH] Upgrade to OPENRNDR 0.3.42-rc.9, add DemoRegularStar02 --- build.gradle | 2 +- ...emoRegularStar.kt => DemoRegularStar01.kt} | 0 .../src/demo/kotlin/DemoRegularStar02.kt | 45 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) rename orx-shapes/src/demo/kotlin/{DemoRegularStar.kt => DemoRegularStar01.kt} (100%) create mode 100644 orx-shapes/src/demo/kotlin/DemoRegularStar02.kt diff --git a/build.gradle b/build.gradle index 193995112..850541736 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'org.jetbrains.dokka' project.ext { - openrndrVersion = "0.3.42-rc.6" + openrndrVersion = "0.3.42-rc.9" kotlinVersion = "1.3.72" spekVersion = "2.0.10" libfreenectVersion = "0.5.7-1.5.3" diff --git a/orx-shapes/src/demo/kotlin/DemoRegularStar.kt b/orx-shapes/src/demo/kotlin/DemoRegularStar01.kt similarity index 100% rename from orx-shapes/src/demo/kotlin/DemoRegularStar.kt rename to orx-shapes/src/demo/kotlin/DemoRegularStar01.kt diff --git a/orx-shapes/src/demo/kotlin/DemoRegularStar02.kt b/orx-shapes/src/demo/kotlin/DemoRegularStar02.kt new file mode 100644 index 000000000..4acd670db --- /dev/null +++ b/orx-shapes/src/demo/kotlin/DemoRegularStar02.kt @@ -0,0 +1,45 @@ +import org.openrndr.application +import org.openrndr.color.ColorRGBa +import org.openrndr.extensions.SingleScreenshot +import org.openrndr.extra.shapes.RoundedRectangle +import org.openrndr.extra.shapes.regularStar +import org.openrndr.math.Vector2 +import kotlin.math.cos +import kotlin.math.sin + +fun main() = application { + program { + // -- this block is for automation purposes only + if (System.getProperty("takeScreenshot") == "true") { + extend(SingleScreenshot()) { + this.outputFile = System.getProperty("screenshotPath") + } + } + extend { + drawer.fill = ColorRGBa.PINK + drawer.stroke = ColorRGBa.WHITE + val radius0 = cos(seconds) * 50.0 + 130.0 + val radius1 = sin(seconds * 2.0) * 50.0 + 130.0 + + val star = regularStar(12, radius0, radius1) + + drawer.translate(width / 2.0, height / 2.0) + drawer.rotate(seconds * 45.0) + drawer.fill = null + drawer.strokeWeight = 2.0 + drawer.contour(star) + + drawer.strokeWeight = 1.0 + drawer.fill = ColorRGBa.WHITE + + for (j in -20 until 20) { + for (i in -20 until 20) { + val q = Vector2(i * 10.0, j * 10.0) + if (q in star) { + drawer.circle(i * 10.0, j * 10.0, 5.0) + } + } + } + } + } +} \ No newline at end of file