But trying to run it on modern day stuff, you're going to see the performance impact for it. Then we got Web Animations, which came out a few years later. Web Animation took all the ideas of GreenSock, all these JavaScript animation libraries, and built it right into the browser. So all of this is just very simple animation code.
We have a collection of spheres. We want to animate them. We're going to give them some key frames. We're going to set some timing. We're going to use this fancy cubic bezier curve. And then we're just going to animate everything and offset it so that by the time they play, we have this nice little animation stagger effect.
But what's cool is that we can pause this. We can hit play. We can catch things just as you see the squash and squish effect, or the stretch and squish effect of this animation cycle. So this is all part of the platform. It's all great.
What's the pain point with this is that as you try to coordinate all these animations, you're going to be writing far more JavaScript to get interactions happen. You want to have an animation play. And then once that's finished, you want to trigger another animation. There's no great way to do that other than just waiting for that transition.
So there is a better way for doing this these days, and that is view transitions. View transitions, if you have not heard of them, they are probably the coolest thing to come to the web. Now a very, very technical definition of what view transitions are. The view transitions API provides a mechanism for easily creating animated transitions between different DOM states while also updating the DOM contents in a single step. You update the DOM, and it'll transition between the different states. Pretty easy.
We can actually think of it as just getting the DOM changes and then the snapshot between the two. But for people who like to see visuals, let's say we have a list of items. We want to remove a list, one list item. We remove it from the DOM. The browser will detect that that has changed and actually transition between all of the different states.
Comments