Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We can't generate a `Tick event on each animation frame #37

Open
aryx opened this issue Nov 3, 2020 · 4 comments
Open

We can't generate a `Tick event on each animation frame #37

aryx opened this issue Nov 3, 2020 · 4 comments

Comments

@aryx
Copy link

aryx commented Nov 3, 2020

For context, I try to port the elm-playground library to OCaml by using ocaml-vdom.

In elm, one can subscribe to the onAnimationFrame Javascript event to generate a Tick (or `Tick) message that
can be used in the update function to provide animations.

I was able to find the onmousemove event in vdom (that I attach as an attribute to the toplevel div), but nothing on animation_frame.
@alainfrisch mention I could use custom event for that, but onAnimationFrame is not listed as one of the possible Javascript event.

@aryx
Copy link
Author

aryx commented Dec 21, 2020

Any help? Is this project dead? Should I switch to another OCaml library (e.g., Brr by daniel buenzli?)

@alainfrisch
Copy link
Contributor

The project is actively used, and we are happy to address bug reports, discuss feature wishes or review PRs.

Your question probably requires doing some manual DOM-based code with CustomElements, using Window.requestAnimationFrame. Feel free to experiment, and if you find a solution, to report if something needs to be added to ocaml-vdom to make the task easier.

@aryx
Copy link
Author

aryx commented Dec 28, 2020

Is there code I should imitate to do that? I'm a JS/Browser noob.

@aryx
Copy link
Author

aryx commented Oct 25, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants