Extend

The program block usually contains an extend block which gets executed as often as possible.

fun main() = application {
    program {
        extend {
            drawer.circle(width / 2.0, height / 2.0, 50.0)
        }
    }
}

The extend block serves as a “draw loop”, which is what we need for drawing smooth animations. To demonstrate that the result is not a still image, let’s draw a circle located wherever the mouse cursor is:

fun main() = application {
    program {
        extend {
            drawer.circle(mouse.position, 50.0)
        }
    }
}

edit on GitHub