3 ms·
Nice animations, you probably worked a lot on them :) I just went through a month-long process of creating a front-page animation for my Lunar app (https://lun
by alin23 4y ago
Nice animations, you probably worked a lot on them :)
I just went through a month-long process of creating a front-page animation for my Lunar app (https://lunar.fyi https://lunar.fyi) and wanted to share some drawbacks that users will be experiencing:
1. A lot of CPU usage because of constantly re-rendering the DOM
2. Choppy animations on Safari and older computers because main thread is blocked often
3. Battery drain and device heating up because of #1
4. Distraction from the text content because of too many moving things on some scenes
I can’t figure out what animation library you used, but I started with anime.js, animating an SVG. Then because of the above issues, I ended up rendering the animation to a compressed video and using that as the background of the website.
Rendering a video is efficient and more battery friendly than re-computing fast DOM changes, mostly because of the hardware decoding capabilities of modern devices. But not all animations can be recorded, and there are other things to consider as well (encoder, size, fps, compression quality etc.)
I also tried using the WebAnimations API which shouldn't block the main thread, but Safari is lagging behind on this one. You can especially notice how “not smooth” the animations on this site are: https://motion.dev/guides/quick-start#animatable-values https://motion.dev/guides/quick-start#animatable-values
- shirdel87 4y agoHey Alin, Thanks for sharing your experience with animation. We will consider to update when it comes to the Safari users.
- pajuhaan 4y agoThanks a lot :) Yes, All animation on the site is designed from scratch by fundamental DOM animations. But I think it will be slow in Safari and old versions of browsers. So I disabled autoplay right now.
- alin23 4y agoAwesome, the website already feels much lighter and snappier!