Squash and Stretch The article discusses the "squash and stretch" principle from Disney's 12 Basic Principles of Animation and how it can be applied to web development, specifically for animating SVG icons. The author demonstrates this technique using a stretchy arrow icon that elongates and thins on hover, providing code examples and implementation details using CSS transitions or JavaScript. The post emphasizes that this animation principle creates visually pleasing micro-interactions that enhance user experience on websites. Have you ever heard of Disney’s 12 Basic Principles of Animation opens in new tab ? It’s a collection of animation best practices created in 1981 by two Disney animators, intended to be used by the folks who produce animated cartoon movies like Aladdin or Beauty And The Beast. Not all of the rules are relevant to us, as web developers, but some of them are incredibly useful. In this blog post, I want to share my favourite rule, and show some of the ways I use it in my projects It’s the very first rule, “squash and stretch”. Let’s start with the most common example, a bouncing ball. Check out what happens as you drag the slider: As you increase the “Squash/Stretch Amount”, the ball starts to flatten like a water balloon when it hits the ground, threatening to burst. As it bounces back up, it elongates, becoming long and skinny. This bouncing ball demo is useful in showcasing the general idea: there’s something visually pleasant about an object getting squashed or stretched during motion. In practice, I find myself using this trick a lot more on SVG icons than with bouncing balls, so that’s what we’ll focus on in this tutorial though I’ll include a full playground for the bouncing ball at the end, for anyone curious . Link to this headingStretchy arrows On this blog, I have lots of little SVG icons that have subtle micro-interactions. For example, on the homepage, I have little arrows that stretch on hover: The arrows aren’t just getting longer; to really sell the effect, the tips of the arrow get pulled in slightly, as though the arrow was getting thinner as it gets longer. Here’s a side-by-side comparison showing this effect with/without the stretch effect. Tap each arrow to trigger the effect:Hover over each arrow to see the difference:Trigger each arrow by focusing and pressing Enter Without Squeeze With Squeeze Isn’t it so much nicer with the squeeze? 😄 Things happen pretty quick in this animation, so here’s another demo that lets you scrub through the full stretch effect: Let’s look at how we can create effects like this Link to this headingImplementing stretchy arrows First, we need an icon to work with. My favourite icon pack these days is Lucide opens in new tab , a fork of the legendary Feather Icons pack, which adds 1000 new icons in the same lovely style. So, let’s grab the arrow-right icon from Lucide, downloading it as an SVG. After reformatting the code and removing unnecessary attributes like xmlns , here’s what we’re left with: