The NoClear
extension
Creative coding frameworks have two different defaults: either they clear the screen before each animation frame or they don’t. OPENRNDR belongs to the first group.
Switching to “draw-without-clearing-the-screen” can be useful to produce complex designs with simple programs.
It is also how pen and paper seems to work: we add ink to the paper and the previous ink does not disappear.
Such behavior can easily be enabled by adding extend(NoClear())
to our programs.
Here an example that draws circles at the current mouse position:
fun main() = application {
program {
backgroundColor = ColorRGBa.PINK
extend(NoClear())
extend {
drawer.circle(mouse.position, 20.0)
}
}
}
Without NoClear
only one circle would be visible at the current mouse location.
Find additional examples and the source code of orx-no-clear in GitHub.