Add descriptions to demos
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.timer.repeat
|
||||
|
||||
/**
|
||||
* A simple demonstration on using the `repeat` method to execute a function
|
||||
* at regular intervals.
|
||||
*
|
||||
* Note that drawing inside the repeat action has no effect.
|
||||
* See DemoRepeat02.kt to learn how to trigger drawing.
|
||||
*
|
||||
*/
|
||||
fun main() = application {
|
||||
program {
|
||||
repeat(2.0) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.openrndr.events.Event
|
||||
import org.openrndr.extra.timer.repeat
|
||||
|
||||
/**
|
||||
* This demonstrates how to combine `repeat {}` with a postponed event to trigger drawing
|
||||
* This demonstrates how to combine `repeat {}` with a postponed event to trigger drawing.
|
||||
*/
|
||||
|
||||
fun main() = application {
|
||||
|
||||
25
orx-timer/src/demo/kotlin/DemoRepeat03.kt
Normal file
25
orx-timer/src/demo/kotlin/DemoRepeat03.kt
Normal file
@@ -0,0 +1,25 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.timer.repeat
|
||||
|
||||
/**
|
||||
* Shows how a `repeat` block can update a variable used
|
||||
* for rendering. In this demo, the `opacity` variable is
|
||||
* reduced on every animation frame, and increased to 1.0
|
||||
* every 2 seconds, creating a pulsating animation effect.
|
||||
*/
|
||||
fun main() = application {
|
||||
program {
|
||||
var opacity = 0.0
|
||||
repeat(2.0) {
|
||||
opacity = 1.0
|
||||
}
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.stroke = ColorRGBa.BLACK.opacify(opacity)
|
||||
drawer.fill = ColorRGBa.WHITE.opacify(opacity)
|
||||
drawer.circle(width / 2.0, height / 2.0, 200.0)
|
||||
opacity *= 0.9
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,13 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.extra.timer.timeOut
|
||||
|
||||
/**
|
||||
* Demonstrates the `timeOut` function.
|
||||
*
|
||||
* It is similar to the `repeat` function,
|
||||
* but it runs only once after the specified delay in seconds.
|
||||
*
|
||||
*/
|
||||
fun main() = application {
|
||||
program {
|
||||
timeOut(2.0) {
|
||||
|
||||
Reference in New Issue
Block a user