Example of gloo_render::request_animation_frame
#319
Labels
question
Further information is requested
gloo_render::request_animation_frame
#319
Hi! Thank you for all your efforts around Gloo. It's very nice.
I'm heaving trouble figuring out how to use
gloo_render::request_animation_frame
and would really appreciate a simple, yet practical example. Probably I'm just missing something basic, as I am quite inexperienced with Rust. An example could go a long way. Below are a few things I tried so far.The simplest approach, basically as I would do it in JS.
This compiles, but produces no output. My understanding is that as soon as the reference to an
AnimationFrame
goes out of scope, the request is cancelled and thestep
callback never called. So the solution has to somehow keep the reference alive. With this in mind I tried the following (in context of a Yew app):I'm getting the following:
This example is Yew specific, so probably only good for demonstration. With a basic example, I hopefully be able to integrate it with my Yew code.
The text was updated successfully, but these errors were encountered: