Improve demos for better screenshots, cleanup

This commit is contained in:
Abe Pazos
2020-05-20 14:08:31 +02:00
committed by Edwin Jakobs
parent d52875769e
commit 677f821ca8
10 changed files with 61 additions and 35 deletions

View File

@@ -1,11 +1,10 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.isolated
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.shapes.RoundedRectangle
import org.openrndr.extra.shapes.regularPolygon
import org.openrndr.extra.shapes.regularStar
import org.openrndr.math.map
import kotlin.math.cos
import kotlin.math.sin
fun main() = application {
program {
@@ -18,12 +17,21 @@ fun main() = application {
extend {
drawer.fill = ColorRGBa.PINK
drawer.stroke = ColorRGBa.WHITE
val radius0 = cos(seconds) * 50.0 + 130.0
val star = regularPolygon(6, radius = radius0)
drawer.translate(width/2.0, height / 2.0)
drawer.rotate(seconds * 45.0)
drawer.contour(star)
for (sides in 0 until 8) {
val radius0 = cos(seconds + sides) * 20.0 + 40.0
val star = regularPolygon(sides + 3, radius = radius0)
drawer.isolated {
translate(
(sides % 4.0).map(0.0, 3.0,
width * 0.2, width * 0.8),
(sides / 4).toDouble().map(0.0, 1.0,
height * 0.3, height * 0.7))
rotate(seconds * 45.0)
contour(star)
}
}
}
}
}

View File

@@ -1,7 +1,6 @@
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 kotlin.math.cos
import kotlin.math.sin
@@ -17,12 +16,12 @@ fun main() = application {
extend {
drawer.fill = ColorRGBa.PINK
drawer.stroke = ColorRGBa.WHITE
val radius0 = cos(seconds) * 50.0 + 130.0
val radius1 = sin(seconds) * 50.0 + 130.0
val radius0 = cos(seconds + 2) * 50.0 + 130.0
val radius1 = sin(seconds + 2) * 50.0 + 130.0
val star = regularStar(5, radius0, radius1)
drawer.translate(width/2.0, height / 2.0)
drawer.translate(width / 2.0, height / 2.0)
drawer.rotate(seconds * 45.0)
drawer.contour(star)
}

View File

@@ -1,7 +1,6 @@
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