Add descriptions to demos

This commit is contained in:
Abe Pazos
2025-11-22 19:08:30 +01:00
parent 72368deb85
commit 522627ca51
45 changed files with 608 additions and 89 deletions

View File

@@ -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) {

View File

@@ -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 {

View 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
}
}
}

View File

@@ -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) {