This month we’re celebrating!
Firstly - TEN EDITIONS! Woo! Thanks for hanging around for that long, we’re honoured to be clogging up your inboxes with SVG nonsense.
Secondly - Cassie is super excited to have started a new job at GreenSock, as Lead bestower of animation superpowers, so we’re going to be having a bit of a GSAP party today.
It’s animation superpower bestowing time! Let’s see what we’ve got in the box this week…
If you’ve played around with SVG before, you’ve probably run into some confusion when SVG transforms don’t act the same as they do in HTML-land.
In SVG, all transforms are based around the
[0,0] coordinates of the SVG viewBox, i.e the top left hand corner of the SVG. This can be annoying as with HTML elements, we’re used to elements transforming around their own center.
When animating with GSAP, the default origin for transforms is the top left corner of your SVG elements. But GSAP also allows us to customize this with two different properties:
transformOrigin allows you to define the origin based on the element bounding box.
svgOrigin allows you to define the origin based on the SVG coordinates.
Where better to go for GSAP knowledge than the GreenSock website itself. This page is the motherload of SVG and GSAP tips
It covers all the syntax you need to know to get started, tips to avoid common mistakes, and resources from around the web.
It also explains some of the bugs and challenges that GSAP solves for you so you can gain a better idea of when to reach for this powerful tool.
GreenSock has a bunch of plugins which can help supercharge your animations, let’s take a look at some of them…
MorphSVG allows you to morph
<path> data even if the number (and type) of points are completely different between the start and end shapes. Powerful stuff.
DrawSVGPlugin allows you to progressively reveal (or hide) the stroke of SVG elements.
You can even team draggable with the InertiaPlugin, for physics type effects, making any element draggable, spinnable or even flickable.
MotionPathPlugin allows you to animate elements along an SVG
<path> or array of points. You can even edit the path in-browser using MotionPathHelper!
Ending off the demos with a healthy dose of GSAP fun from Jhey!
No plugins here, but we love how Jhey combines so many of his demos with noises. Make sure to leave your sound on. 🔈
If you’re more of a visual learner, here’s an episode of Learn with Jason to get you started.
We cover staggering animations, SVG masking and scroll based animation using ScrollTrigger
If you want to play around with any of these plugins, here’s a codepen you can fork with all the bonus plugins included.
Happy GSAP-ing gang! We’ll see you next month for more SVG fun.