Principles for smooth web animations
blog.gyrosco.pe
blog.gyrosco.pe
Hopefully everyone will start copying the approach Servo uses in its WebRender engine which is basically treating the browser rendering as though it were a game, using the GPU for rendering everything; therefore guidelines like this become obsolete.
This applies to a slightly lesser extent with #2, “Hide content in plain sight.” #3 is also obsolete in Servo, as is #7, mostly.
I've always followed this rule: Use transform unless you need reflows, then use top/left/height/width.
CSS transform is used because render is slow. With Servo-like GPU acceleration, render is not slow. Your suggestion would not be a good suggestion because using transform would be an unnecessary premature optimization then.
Although opacity can have some gnarly fill implications if you go crazy with it.
Overall though, yeah web stuff falls well behind more modern UI renderers like HWUI on Android and the like.
Also, there is completely no handle on keeping the animations smooth as webpages become more complicated and do (perhaps unrelated) updates while animations are running.
If you need to run every frame of animation from JS then, yes, you're screwed. At least until https://groups.google.com/a/chromium.org/d/topic/blink-dev/Y... & https://github.com/flackr/compositor-worker)
Edit: corrected. But I can't delete? Oh, I have replies :)
Tweening actually goes back to traditional animation where the keyframes (another borrowed term) were hand-drawn by senior artists and the frames in between were added by junior artists. This process was called inbetweening, or tweening for short.
https://material.google.com/motion/material-motion.html#mate...
I think animations are very much over used on that site. The article is fine. But dont do too much animations! Keep congnitive load small!
I've been using GSAP for almost a decade since the Flash days.
In the best case, web animations just cause bloat and burn through your battery. In the (common) worst case, they stutter or break or cause things to on the page to hang while they load.
Just don't do it. Your website doesn't need to look like a mobile app.
Sure, there are good and bad instances of animation, but to state that at best it's a battery drain is just patently false.