Remove unnecessary uses of "takeScreenshot" (#349)

This commit is contained in:
Abe Pazos
2024-09-02 12:15:44 +02:00
committed by GitHub
parent 141d1fa789
commit f713ca3a3d
25 changed files with 34 additions and 141 deletions

View File

@@ -73,15 +73,29 @@ abstract class Tracker<T : Envelope>(val clock: Clock) {
class ADSRTracker(clock: Clock) : Tracker<ADSR>(clock) { class ADSRTracker(clock: Clock) : Tracker<ADSR>(clock) {
/**
* The time it takes to transition to 1.0 when calling [triggerOn], usually in seconds.
*/
@DoubleParameter("attack", 0.0, 20.0, order = 1) @DoubleParameter("attack", 0.0, 20.0, order = 1)
var attack: Double = 0.1 var attack: Double = 0.1
/**
* The time it takes to transition from 1.0 to the [sustain] level, usually in seconds.
* The decay happens immediately after the attack.
*/
@DoubleParameter("decay", 0.0, 20.0, order = 2) @DoubleParameter("decay", 0.0, 20.0, order = 2)
var decay: Double = 0.1 var decay: Double = 0.1
/**
* The sustain level, between 0.0 and 1.0.
* The tracker will keep this value until [triggerOff] is called.
*/
@DoubleParameter("sustain", 0.0, 1.0, order = 3) @DoubleParameter("sustain", 0.0, 1.0, order = 3)
var sustain: Double = 0.9 var sustain: Double = 0.9
/**
* The time it takes to transition back to 0.0 when calling [triggerOff], usually in seconds.
*/
@DoubleParameter("release", 0.0, 20.0, order = 4) @DoubleParameter("release", 0.0, 20.0, order = 4)
var release: Double = 0.9 var release: Double = 0.9

View File

@@ -210,6 +210,11 @@ For example `(M0 (h1 m1)[3])[2]` expands to `M0 h1 m1 h1 m1 h1 m1 M0 h1 m1 h1 m1
![DemoFCurve02Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-fcurve/images/DemoFCurve02Kt.png) ![DemoFCurve02Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-fcurve/images/DemoFCurve02Kt.png)
### DemoFCurve03
[source code](src/jvmDemo/kotlin/DemoFCurve03.kt)
![DemoFCurve03Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-fcurve/images/DemoFCurve03Kt.png)
### DemoFCurveSheet01 ### DemoFCurveSheet01
[source code](src/jvmDemo/kotlin/DemoFCurveSheet01.kt) [source code](src/jvmDemo/kotlin/DemoFCurveSheet01.kt)

View File

@@ -1,6 +1,7 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.draw.colorBuffer import org.openrndr.draw.colorBuffer
import org.openrndr.draw.createEquivalent import org.openrndr.draw.createEquivalent
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.fx.distort.FluidDistort import org.openrndr.extra.fx.distort.FluidDistort
import org.openrndr.extra.fx.patterns.Checkers import org.openrndr.extra.fx.patterns.Checkers
@@ -8,15 +9,21 @@ fun main() {
application { application {
program { program {
val fd = FluidDistort() val fd = FluidDistort()
val checkers = Checkers() val checkers = Checkers()
val image = colorBuffer(width, height) val image = colorBuffer(width, height)
val distorted = image.createEquivalent() val distorted = image.createEquivalent()
checkers.size = 64.0 checkers.size = 64.0
checkers.apply(emptyArray(), image) checkers.apply(emptyArray(), image)
if (System.getProperty("takeScreenshot") == "true") {
extensions.filterIsInstance<SingleScreenshot>().forEach {
it.delayFrames = 150
}
}
extend { extend {
fd.blend = mouse.position.x/width // Ensure >0.01 for a better screenshot
fd.blend = (mouse.position.x / width).coerceAtLeast(0.01)
fd.apply(image, distorted) fd.apply(image, distorted)
drawer.image(distorted) drawer.image(distorted)
} }

View File

@@ -20,12 +20,6 @@
// } // }
// //
// program { // program {
// if (System.getProperty("takeScreenshot") == "true") {
// extend(SingleScreenshot()) {
// this.outputFile = System.getProperty("screenshotPath")
// }
// }
//
// val gui = GUI() // val gui = GUI()
// val c = compose { // val c = compose {
// layer { // layer {

View File

@@ -6,11 +6,6 @@
// //
//fun main() = application { //fun main() = application {
// program { // program {
// if (System.getProperty("takeScreenshot") == "true") {
// extend(SingleScreenshot()) {
// this.outputFile = System.getProperty("screenshotPath")
// }
// }
// val ga = extend(GitArchiver()) { // val ga = extend(GitArchiver()) {
// commitOnRun = true // commitOnRun = true
// commitOnRequestAssets = false // commitOnRequestAssets = false

View File

@@ -12,13 +12,6 @@ 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(GUIAppearance(baseColor = ColorRGBa.GRAY.opacify(0.9), barWidth = 400)) val gui = GUI(GUIAppearance(baseColor = ColorRGBa.GRAY.opacify(0.9), barWidth = 400))
gui.compartmentsCollapsedByDefault = false gui.compartmentsCollapsedByDefault = false

View File

@@ -11,11 +11,6 @@ fun main() = application {
} }
val animation = Animation() val animation = Animation()
animation.loadFromJson(URL(resourceUrl("/demo-envelope-01.json"))) animation.loadFromJson(URL(resourceUrl("/demo-envelope-01.json")))
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend { extend {
animation(seconds) animation(seconds)
drawer.circle(animation.position, 100.0) drawer.circle(animation.position, 100.0)

View File

@@ -14,11 +14,6 @@ fun main() = application {
} }
val animation = Animation() val animation = Animation()
animation.loadFromJson(URL(resourceUrl("/demo-full-01.json")), format = KeyframerFormat.FULL) animation.loadFromJson(URL(resourceUrl("/demo-full-01.json")), format = KeyframerFormat.FULL)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend { extend {
animation(seconds) animation(seconds)
drawer.fill = animation.color drawer.fill = animation.color

View File

@@ -30,11 +30,6 @@ fun main() = application {
} }
} }
} }
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(cm) extend(cm)
class Animation: Keyframer() { class Animation: Keyframer() {
val position by Vector2Channel(arrayOf("x", "y")) val position by Vector2Channel(arrayOf("x", "y"))

View File

@@ -11,11 +11,6 @@ fun main() = application {
} }
val animation = Animation() val animation = Animation()
animation.loadFromJson(URL(resourceUrl("/demo-simple-01.json"))) animation.loadFromJson(URL(resourceUrl("/demo-simple-01.json")))
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend { extend {
animation(seconds) animation(seconds)
drawer.circle(animation.position, 100.0) drawer.circle(animation.position, 100.0)

View File

@@ -13,11 +13,6 @@ fun main() = application {
} }
val animation = Animation() val animation = Animation()
animation.loadFromJson(URL(resourceUrl("/demo-simple-02.json"))) animation.loadFromJson(URL(resourceUrl("/demo-simple-02.json")))
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend { extend {
animation(seconds) animation(seconds)
drawer.fill = animation.color drawer.fill = animation.color

View File

@@ -14,11 +14,6 @@ fun main() = application {
val animation = Animation() val animation = Animation()
animation.loadFromJson(URL(resourceUrl("/demo-simple-expressions-01.json")), animation.loadFromJson(URL(resourceUrl("/demo-simple-expressions-01.json")),
parameters = mapOf("cycleDuration" to 2.0)) parameters = mapOf("cycleDuration" to 2.0))
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend { extend {
animation(seconds) animation(seconds)
drawer.circle(animation.position, animation.radius) drawer.circle(animation.position, animation.radius)

View File

@@ -12,12 +12,6 @@ import org.openrndr.panel.style.*
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 cm = controlManager { val cm = controlManager {
styleSheet(has class_ "horizontal") { styleSheet(has class_ "horizontal") {
paddingLeft = 10.px paddingLeft = 10.px

View File

@@ -8,12 +8,6 @@ import org.openrndr.panel.style.*
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 cm = controlManager { val cm = controlManager {
styleSheet(has class_ "side-bar") { styleSheet(has class_ "side-bar") {
this.height = 100.percent this.height = 100.percent

View File

@@ -41,12 +41,6 @@ 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 programState = ProgramState() val programState = ProgramState()
val cm = controlManager { val cm = controlManager {
layout { layout {

View File

@@ -17,12 +17,6 @@ fun main() = application {
var z = 0 var z = 0
} }
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val programState = State() val programState = State()
val cm = controlManager { val cm = controlManager {
layout { layout {

View File

@@ -15,13 +15,6 @@ 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("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0) val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0)
val settings = object { val settings = object {

View File

@@ -12,13 +12,6 @@ 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 {

View File

@@ -15,13 +15,6 @@ fun main() = application {
} }
program { program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
/** /**
* Start RabbitControlServer with a Rabbithole with key 'orxtest' * Start RabbitControlServer with a Rabbithole with key 'orxtest'
* Please visit https://rabbithole.rabbitcontrol.cc for more information. * Please visit https://rabbithole.rabbitcontrol.cc for more information.

View File

@@ -11,11 +11,6 @@ fun main() {
val size = Envelope(50.0, 400.0, 0.5, 0.5) val size = Envelope(50.0, 400.0, 0.5, 0.5)
val rotation = Envelope(easingFactor = 0.4) val rotation = Envelope(easingFactor = 0.4)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(TimeOperators()) { extend(TimeOperators()) {
track(size, rotation) track(size, rotation)
} }

View File

@@ -12,9 +12,8 @@ fun main() {
val size = LFO() val size = LFO()
val rotation = LFO(LFOWave.Sine) val rotation = LFO(LFOWave.Sine)
if (System.getProperty("takeScreenshot") == "true") { if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) { extensions.filterIsInstance<SingleScreenshot>().forEach {
this.delayFrames = 10 it.delayFrames = 10
this.outputFile = System.getProperty("screenshotPath")
} }
} }
extend(TimeOperators()) { extend(TimeOperators()) {

View File

@@ -33,19 +33,6 @@ fun main() = application {
Note that drawing inside the `repeat` action has no effect. Have a look at the demos listed below for an example of Note that drawing inside the `repeat` action has no effect. Have a look at the demos listed below for an example of
`repeat` triggered drawing. `repeat` triggered drawing.
## Demos
* [Simple `repeat` demonstration](src/demo/kotlin/DemoRepeat01.kt)
* [A `repeat` demonstration with drawing](src/demo/kotlin/DemoRepeat02.kt)
* [Simple `timeOut` demonstration](src/demo/kotlin/DemoTimeOut01.kt)
<!-- __demos__ >
# Demos
[DemoRepeat01Kt](src/demo/kotlin/DemoRepeat01Kt.kt
![DemoRepeat01Kt](https://github.com/openrndr/orx/blob/media/orx-timer/images/DemoRepeat01Kt.png
[DemoRepeat02Kt](src/demo/kotlin/DemoRepeat02Kt.kt
![DemoRepeat02Kt](https://github.com/openrndr/orx/blob/media/orx-timer/images/DemoRepeat02Kt.png
[DemoTimeOut01Kt](src/demo/kotlin/DemoTimeOut01Kt.kt
![DemoTimeOut01Kt](https://github.com/openrndr/orx/blob/media/orx-timer/images/DemoTimeOut01Kt.png
<!-- __demos__ --> <!-- __demos__ -->
## Demos ## Demos
### DemoRepeat01 ### DemoRepeat01

View File

@@ -1,19 +1,10 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.timer.repeat import org.openrndr.extra.timer.repeat
fun main() = application { fun main() = application {
program { program {
repeat(2.0) { repeat(2.0) {
println("hello there $seconds" ) println("hello there $seconds")
}
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend {
} }
} }
} }

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.events.Event import org.openrndr.events.Event
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.timer.repeat import org.openrndr.extra.timer.repeat
/** /**
@@ -19,11 +18,6 @@ fun main() = application {
// -- we can not draw here, so we relay the repeat signal to the event // -- we can not draw here, so we relay the repeat signal to the event
event.trigger(null) event.trigger(null)
} }
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend { extend {
drawer.clear(ColorRGBa.PINK) drawer.clear(ColorRGBa.PINK)
// -- by explicitly calling deliver we know that the drawing code in the listener will be // -- by explicitly calling deliver we know that the drawing code in the listener will be

View File

@@ -1,16 +1,10 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.timer.timeOut import org.openrndr.extra.timer.timeOut
fun main() = application { fun main() = application {
program { program {
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
timeOut(2.0) { timeOut(2.0) {
println("hello there $seconds" ) println("hello there $seconds")
} }
} }
} }