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) {
/**
* The time it takes to transition to 1.0 when calling [triggerOn], usually in seconds.
*/
@DoubleParameter("attack", 0.0, 20.0, order = 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)
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)
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)
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)
### DemoFCurve03
[source code](src/jvmDemo/kotlin/DemoFCurve03.kt)
![DemoFCurve03Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-fcurve/images/DemoFCurve03Kt.png)
### DemoFCurveSheet01
[source code](src/jvmDemo/kotlin/DemoFCurveSheet01.kt)

View File

@@ -1,6 +1,7 @@
import org.openrndr.application
import org.openrndr.draw.colorBuffer
import org.openrndr.draw.createEquivalent
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.fx.distort.FluidDistort
import org.openrndr.extra.fx.patterns.Checkers
@@ -15,8 +16,14 @@ fun main() {
checkers.size = 64.0
checkers.apply(emptyArray(), image)
if (System.getProperty("takeScreenshot") == "true") {
extensions.filterIsInstance<SingleScreenshot>().forEach {
it.delayFrames = 150
}
}
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)
drawer.image(distorted)
}

View File

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

View File

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

View File

@@ -12,13 +12,6 @@ import org.openrndr.shape.Circle
*/
fun main() = application {
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))
gui.compartmentsCollapsedByDefault = false

View File

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

View File

@@ -14,11 +14,6 @@ fun main() = application {
}
val animation = Animation()
animation.loadFromJson(URL(resourceUrl("/demo-full-01.json")), format = KeyframerFormat.FULL)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend {
animation(seconds)
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)
class Animation: Keyframer() {
val position by Vector2Channel(arrayOf("x", "y"))

View File

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

View File

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

View File

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

View File

@@ -12,12 +12,6 @@ import org.openrndr.panel.style.*
fun main() = application {
program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val cm = controlManager {
styleSheet(has class_ "horizontal") {
paddingLeft = 10.px

View File

@@ -8,12 +8,6 @@ import org.openrndr.panel.style.*
fun main() = application {
program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val cm = controlManager {
styleSheet(has class_ "side-bar") {
this.height = 100.percent

View File

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

View File

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

View File

@@ -15,13 +15,6 @@ fun main() = application {
}
program {
// -- this block is for automation purposes only
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
val rabbit = RabbitControlServer()
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 20.0)
val settings = object {

View File

@@ -12,13 +12,6 @@ fun main() = application {
}
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 settings = object {

View File

@@ -15,13 +15,6 @@ fun main() = application {
}
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'
* 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 rotation = Envelope(easingFactor = 0.4)
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend(TimeOperators()) {
track(size, rotation)
}

View File

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

View File

@@ -1,5 +1,4 @@
import org.openrndr.application
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.timer.repeat
fun main() = application {
@@ -7,13 +6,5 @@ fun main() = application {
repeat(2.0) {
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.color.ColorRGBa
import org.openrndr.events.Event
import org.openrndr.extensions.SingleScreenshot
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
event.trigger(null)
}
if (System.getProperty("takeScreenshot") == "true") {
extend(SingleScreenshot()) {
this.outputFile = System.getProperty("screenshotPath")
}
}
extend {
drawer.clear(ColorRGBa.PINK)
// -- by explicitly calling deliver we know that the drawing code in the listener will be

View File

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