gcx11
06/23/2018, 2:24 PMlaunch {
while (true) {
context.clearRect(
0.0,
0.0,
context.canvas.width.toDouble(),
context.canvas.height.toDouble()
)
draw(context)
delay(1000 / 60)
}
}
napperley
06/24/2018, 2:35 AMuli
06/24/2018, 8:35 AMgcx11
06/24/2018, 11:10 AMuli
06/24/2018, 11:42 AMuli
06/24/2018, 11:45 AMuli
06/24/2018, 11:47 AMgcx11
06/24/2018, 11:55 AMbashor
06/25/2018, 12:45 PMbashor
06/25/2018, 12:53 PMwindow.requestAnimationFrame
to get better UX. And with kotlinx-coroutines-core-js
you can use window.awaitAnimationFrame()
like here https://github.com/Kotlin/kotlinx.coroutines/blob/5f2e94b7631616683eb7b8aec00e8cf4a594a299/js/example-frontend-js/src/main/kotlin/ExampleMain.kt#L198