Add orx-timer
This commit is contained in:
13
orx-timer/src/demo/kotlin/DemoRepeat01.kt
Normal file
13
orx-timer/src/demo/kotlin/DemoRepeat01.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.timer.repeat
|
||||
|
||||
fun main() = application {
|
||||
program {
|
||||
repeat(2.0) {
|
||||
println("hello there $seconds" )
|
||||
}
|
||||
extend {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
27
orx-timer/src/demo/kotlin/DemoRepeat02.kt
Normal file
27
orx-timer/src/demo/kotlin/DemoRepeat02.kt
Normal file
@@ -0,0 +1,27 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.events.Event
|
||||
import org.openrndr.extra.timer.repeat
|
||||
|
||||
/**
|
||||
* This demonstrates how to combine `repeat {}` with a postponed event to trigger drawing
|
||||
*/
|
||||
|
||||
fun main() = application {
|
||||
program {
|
||||
val event = Event<Any?>().postpone(true)
|
||||
event.listen {
|
||||
drawer.circle(width / 2.0, height / 2.0, 200.0)
|
||||
}
|
||||
repeat(2.0) {
|
||||
// -- we can not draw here, so we relay the repeat signal to the event
|
||||
event.trigger(null)
|
||||
}
|
||||
extend {
|
||||
drawer.background(ColorRGBa.PINK)
|
||||
// -- by explicitly calling deliver we know that the drawing code in the listener will be
|
||||
// -- executed exactly here
|
||||
event.deliver()
|
||||
}
|
||||
}
|
||||
}
|
||||
10
orx-timer/src/demo/kotlin/DemoTimeOut01.kt
Normal file
10
orx-timer/src/demo/kotlin/DemoTimeOut01.kt
Normal file
@@ -0,0 +1,10 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.timer.timeOut
|
||||
|
||||
fun main() = application {
|
||||
program {
|
||||
timeOut(2.0) {
|
||||
println("hello there $seconds" )
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user