How to Animate Along a Path with SVG
Another fun use of paths is to create animation paths. This method is not SVG only. We are using the offset-path
CSS property here that works for any other HTML element as well. But if you check the value of this attribute, you see that we define a path the same way as we do for an SVG.
To break this down into two parts, first, we have the track. We define this as a single path.
And then we have a sled, that is made out of two different paths grouped together.
Neither of these are very interesting on their own. What is new, is that we can add an animation where the animation path is essentially the same as the path of the track. The animation path is only slightly different to make the sledge fit the path even better. By default, the bottom-middle part of the sled would move along the path and the beginning and end of it would slightly sink into the path. Instead of that alter the path to raise the sled slightly at some tight turns.