Frontend.fyi

Tutorial

Combining scroll-driven animations and SVG path animations to rebuild Apple's pencil draw animation

In this tutorial we will combine an age old technique to animation SVG paths, and combine it with super modern scroll-driven animations to rebuild a beautiful animation.

Try it yourself in our playground

Follow along with the tutorial, or just play around with the code. PRO members can fork this code and save it to their account.

User avatar

Jeroen Reumkens PRO

Animating SVG Paths with Scroll-Driven Animations. All Tailwind classes are for generic styles only. The animation can be found in the CSS file.

Unlock Playground Access

Playgrounds let you build, test, and share frontend ideas instantly — right in your browser. Access is included in PRO. Just want Playgrounds? Pick a plan below.

Maker

€5,- / month

Unlimited Playgrounds access to build, experiment, and share without limits.

Join for €5 per month

Champion

€10,- / month

All the benefits of Maker, plus you help Frontend.fyi grow and get a Champion badge on your profile.

Join for €10 per month

Cancel anytime — no commitment.
Upgrade to PRO anytime and get a partial refund.We'll credit 100% of your first 3 months and 50% of the rest toward the PRO lifetime price.

Already a member? Login

Last week I came across this Tweet by Wes Bos where he showcased a super neat animation on Apple’s website. I couldn’t stop but notice that Apple still used some JavaScript to pull of this effect, while there is a super modern way to do this with just CSS (see below for browser support).

So I decided this was the perfect opportunity to finally show you all how you can animate SVG paths, and combine it with scroll-driven animations.

A note on browser support

At the time of making this tutorial (july 2024) the animation-timeline is supported in Chromium browsers, with Firefox and Safari working hard on it. In Firefox you can even already experiment with it behind a flag.

Take a look at the diagram below for the latest status.

Eager to learn more?

I think this video might be a good fit for you too!