Hacker News new | ask | show | jobs
by Permik 709 days ago
Just as a curiosity, have you thought about transforming the target value stepping down to web animations api calls?

That way the implementation could _probably_ get some free performance as the browser could pre-calc some stuff ahead of time, without the need for you to brute force every calc on top of the js engine.

2 comments

Thank you for your feedback. Currently, animations are handled using transform: translate by directly manipulating the styles of elements with JavaScript. I think this offloads the work to the GPU. This approach also gives the ability to animate in response to user actions which could be frequent like scrolling and no fixed time frame is known beforehand.

However, I agree that using the Web Animations API could be beneficial when user actions are not involved. This is a great suggestion, and I haven't given it much thought before. I will consider adding a separate API for it using the Web Animations API.

Thank you again for the great suggestion! I’ve reflected on it and decided to work on integrating the Web Animations API. Users will be able to choose between using the Web Animations API or more direct DOM manipulation at runtime, selecting their preference in the target itself. Thanks again for the feedback.
No problem! Happy that I could help :)

I'll be eagerly waiting what you come up with!