Files
orx/orx-timer
2020-04-27 16:11:14 +02:00
..
2020-04-27 09:58:03 +00:00
2020-04-22 21:56:08 +02:00
2020-04-22 21:56:08 +02:00
2020-04-27 16:11:14 +02:00

orx-timer

orx-timer adds simple timer functionality to OPENRNDR's Program

Prerequisites

Add orx-timer to the orxFeatures set in your build.gradle.kts

Usage

orx-timer facilitates two extension functions for Program

fun Program.repeat(intervalInSeconds: Double, count: Int? = null, initialDelayInSeconds: Double = 0.0, action: () -> Unit)

fun Program.timeOut(delayInSeconds: Double, action: () -> Unit)

A simple example looks like this:

fun main() = application {
    program {
        repeat(2.0) {
            println("hello there")
        }
        extend {

        }
    }
}

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

Demos

DemoRepeat01Kt DemoRepeat01Kt DemoRepeat02Kt DemoRepeat02Kt DemoTimeOut01Kt DemoTimeOut01Kt