Skip to content

0J Draw animations with canvas

Luis Murillo Baltodano edited this page Aug 3, 2020 · 1 revision

Using the draw function

preset(({draw}) => {
    draw(() => {
        // rendering functions and more can go here
    }, optionalFrameRate)
})

This uses requestAnimationFrame under the hood

About optionalFrameRate

You could set it between 0 and a maximumFrameRate fps which by the default is 60

About maximumFrameRate

I you want to change the default maximumFrameRate just bind and object like

anyConfig {
    maxFrameRate Number // your desired maximum frame rate
}

This also depends on the browser's implementation of requestAnimationFrame for the maximum frame rate

Information about frame rates

Clone this wiki locally