852 B
852 B
web-sys
: A requestAnimationFrame
Loop
View full source code or view the compiled example online
This is an example of a requestAnimationFrame
loop using the web-sys
crate!
It renders a count of how many times a requestAnimationFrame
callback has been
invoked and then it breaks out of the requestAnimationFrame
loop after 300
iterations.
Cargo.toml
You can see here how we depend on web-sys
and activate associated features to
enable all the various APIs:
{{#include ../../../examples/request-animation-frame/Cargo.toml}}
src/lib.rs
{{#include ../../../examples/request-animation-frame/src/lib.rs}}