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

@@ -16,6 +16,13 @@ enum class BackgroundColors {
fun main() = application { fun main() = application {
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val gui = GUI() val gui = GUI()
gui.compartmentsCollapsedByDefault = false gui.compartmentsCollapsedByDefault = false
val settings = @Description("Settings") object { val settings = @Description("Settings") object {
@@ -24,11 +31,6 @@ fun main() = application {
} }
gui.add(settings) gui.add(settings)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(gui) extend(gui)
extend { extend {
when(settings.option) { when(settings.option) {

View File

@@ -11,6 +11,13 @@ import org.openrndr.shape.Circle
*/ */
fun main() = application { fun main() = application {
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val gui = GUI() val gui = GUI()
gui.compartmentsCollapsedByDefault = false gui.compartmentsCollapsedByDefault = false
@@ -28,11 +35,6 @@ fun main() = application {
var radii = mutableListOf(5.0, 6.0, 8.0, 14.0, 20.0, 30.0) var radii = mutableListOf(5.0, 6.0, 8.0, 14.0, 20.0, 30.0)
} }
gui.add(settings) gui.add(settings)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(gui) extend(gui)
extend { extend {
drawer.fill = settings.color drawer.fill = settings.color

View File

@@ -1,4 +1,5 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.gui.GUI import org.openrndr.extra.gui.GUI
import org.openrndr.extra.parameters.Description import org.openrndr.extra.parameters.Description
import org.openrndr.extra.parameters.XYParameter import org.openrndr.extra.parameters.XYParameter
@@ -11,7 +12,15 @@ fun main() = application {
} }
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val gui = GUI() val gui = GUI()
gui.compartmentsCollapsedByDefault = false
val settings = @Description("Settings") object { val settings = @Description("Settings") object {
@XYParameter("Position", 0.0, 800.0, 0.0, 800.0, @XYParameter("Position", 0.0, 800.0, 0.0, 800.0,

View File

@@ -10,6 +10,7 @@ import org.openrndr.extra.jumpfill.ops.*
import org.openrndr.math.Vector3 import org.openrndr.math.Vector3
import org.openrndr.math.transforms.transform import org.openrndr.math.transforms.transform
import org.openrndr.svg.loadSVG import org.openrndr.svg.loadSVG
import kotlin.math.min
fun main() { fun main() {
application { application {
@@ -32,6 +33,7 @@ fun main() {
val strokeFill = SDFStrokeFill() val strokeFill = SDFStrokeFill()
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") { if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) { extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath") this.outputFile = System.getProperty("screenshotPath")
@@ -50,14 +52,14 @@ fun main() {
sdf1.setShapes(shapes.mapIndexed { index, it -> sdf1.setShapes(shapes.mapIndexed { index, it ->
it.transform(transform { it.transform(transform {
translate(1280 / 2.0, 720.0 / 2) translate(1280 / 2.0, 720.0 / 2)
rotate(Vector3.Companion.UNIT_Z, seconds * 45.0) rotate(Vector3.Companion.UNIT_Z, seconds * 45.0 - 30.0)
translate(-1280 / 2.0, -720.0 / 2.0) translate(-1280 / 2.0, -720.0 / 2.0)
}) })
}) })
sdf0.apply(emptyArray(), df0) sdf0.apply(emptyArray(), df0)
sdf1.apply(emptyArray(), df1) sdf1.apply(emptyArray(), df1)
union.radius = mouse.position.y union.radius = 10.0 + min(mouse.position.y, 100.0)
union.apply(arrayOf(df0, df1), df0) union.apply(arrayOf(df0, df1), df0)
onion.radius = 20.0 onion.radius = 20.0
onion.apply(df0, df0) onion.apply(df0, df0)

View File

@@ -15,6 +15,13 @@ fun main() = application {
} }
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val rabbit = RabbitControlServer() val rabbit = RabbitControlServer()
val font= loadFont("orx-rabbit-control/src/demo/resources/fonts/Roboto-Regular.ttf", 20.0) val font= loadFont("orx-rabbit-control/src/demo/resources/fonts/Roboto-Regular.ttf", 20.0)
val settings = object { val settings = object {
@@ -49,11 +56,6 @@ fun main() = application {
} }
rabbit.add(settings) rabbit.add(settings)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(rabbit) extend(rabbit)
extend { extend {
drawer.clear(if (settings.b) ColorRGBa.BLUE else ColorRGBa.BLACK) drawer.clear(if (settings.b) ColorRGBa.BLUE else ColorRGBa.BLACK)

View File

@@ -12,6 +12,13 @@ fun main() = application {
} }
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val rabbit = RabbitControlServer(showQRUntilClientConnects = false) val rabbit = RabbitControlServer(showQRUntilClientConnects = false)
val settings = object { val settings = object {
@@ -20,11 +27,6 @@ fun main() = application {
} }
rabbit.add(settings) rabbit.add(settings)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(rabbit) extend(rabbit)
/** /**

View File

@@ -1,11 +1,10 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.isolated
import org.openrndr.extensions.SingleScreenshot import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.shapes.RoundedRectangle
import org.openrndr.extra.shapes.regularPolygon import org.openrndr.extra.shapes.regularPolygon
import org.openrndr.extra.shapes.regularStar import org.openrndr.math.map
import kotlin.math.cos import kotlin.math.cos
import kotlin.math.sin
fun main() = application { fun main() = application {
program { program {
@@ -18,12 +17,21 @@ fun main() = application {
extend { extend {
drawer.fill = ColorRGBa.PINK drawer.fill = ColorRGBa.PINK
drawer.stroke = ColorRGBa.WHITE 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) for (sides in 0 until 8) {
drawer.rotate(seconds * 45.0) val radius0 = cos(seconds + sides) * 20.0 + 40.0
drawer.contour(star) 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.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.extensions.SingleScreenshot import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.shapes.RoundedRectangle
import org.openrndr.extra.shapes.regularStar import org.openrndr.extra.shapes.regularStar
import kotlin.math.cos import kotlin.math.cos
import kotlin.math.sin import kotlin.math.sin
@@ -17,12 +16,12 @@ fun main() = application {
extend { extend {
drawer.fill = ColorRGBa.PINK drawer.fill = ColorRGBa.PINK
drawer.stroke = ColorRGBa.WHITE drawer.stroke = ColorRGBa.WHITE
val radius0 = cos(seconds) * 50.0 + 130.0 val radius0 = cos(seconds + 2) * 50.0 + 130.0
val radius1 = sin(seconds) * 50.0 + 130.0 val radius1 = sin(seconds + 2) * 50.0 + 130.0
val star = regularStar(5, radius0, radius1) 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.rotate(seconds * 45.0)
drawer.contour(star) drawer.contour(star)
} }

View File

@@ -1,7 +1,6 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.extensions.SingleScreenshot import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.shapes.RoundedRectangle
import org.openrndr.extra.shapes.regularStar import org.openrndr.extra.shapes.regularStar
import org.openrndr.math.Vector2 import org.openrndr.math.Vector2
import kotlin.math.cos import kotlin.math.cos

View File

@@ -13,6 +13,7 @@ fun main() {
val rotation = LFO(LFOWave.Sine) val rotation = LFO(LFOWave.Sine)
if (System.getProperty("takeScreenshot") == "true") { if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) { extend(SingleScreenshot()) {
this.delayFrames = 10
this.outputFile = System.getProperty("screenshotPath") this.outputFile = System.getProperty("screenshotPath")
} }
} }