[orx-jvm] Move panel, gui, dnk3, keyframer, triangulation to orx-jvm
This commit is contained in:
52
orx-jvm/orx-keyframer/src/demo/kotlin/DemoScrub01.kt
Normal file
52
orx-jvm/orx-keyframer/src/demo/kotlin/DemoScrub01.kt
Normal file
@@ -0,0 +1,52 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.keyframer.Keyframer
|
||||
import org.openrndr.panel.controlManager
|
||||
import org.openrndr.panel.elements.Range
|
||||
import org.openrndr.panel.elements.Slider
|
||||
import org.openrndr.panel.elements.slider
|
||||
import org.openrndr.resourceUrl
|
||||
import java.net.URL
|
||||
|
||||
suspend fun main() = application {
|
||||
program {
|
||||
|
||||
// -- replace the default clock with an offset clock
|
||||
var clockOffset = 0.0
|
||||
val oldClock = clock
|
||||
clock = { oldClock() - clockOffset }
|
||||
var clockSlider: Slider? = null
|
||||
|
||||
// -- setup a simple UI
|
||||
val cm = controlManager {
|
||||
layout {
|
||||
clockSlider = slider {
|
||||
range = Range(0.0, 30.0)
|
||||
events.valueChanged.listen {
|
||||
if (it.interactive) {
|
||||
clockOffset = oldClock() - it.newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
extend(cm)
|
||||
class Animation: Keyframer() {
|
||||
val position by Vector2Channel(arrayOf("x", "y"))
|
||||
}
|
||||
val animation = Animation()
|
||||
animation.loadFromJson(URL(resourceUrl("/demo-simple-01.json")))
|
||||
|
||||
extend {
|
||||
// -- update the slider
|
||||
clockSlider?.value = seconds
|
||||
animation(seconds)
|
||||
drawer.circle(animation.position, 100.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user