Recently, I began writing my series for Tuts+ discussing in-depth how to use and understand TimelineMax by GreenSock. The results of my studies and research has thrusted me from a CSS animation lover to someone that appreciates the fine control achieved with the GreenSock Animation Platform (GSAP). Let’s examine the benefits of this control using a couple of amazing pieces of artwork presented as SVG.
Move. Them. Polygons!
The lion’s head is composed of one single SVG element. Inside the SVG are the related polygon shapes that create the entire head of the lion. Think of each polygon shape as a single DOM node. In order to animate each polygon shape that composes the lion’s head with CSS we’d have to summon the powers of the Sith lord when it comes to counting the presence of each polygon shape and controlling individual tweens along with their associated timing position (where the magic really happens).
As you can see with the result above, the degree of control is astounding! Not only can I control each polygon shape individually to stagger their movement, I can also offset their trigger time or make the polygon shapes react in a single moment like the case is with this next example:
The reason I show you all this is to make a case for GSAP. Yes, CSS is great and I’m not one to turn my back on it, but there are times when you can’t do everything with CSS that you see in your mind’s eye. It’s also a showcase for the power and strength that GSAP gives authors…plus you have to admit it’s a pretty cool effect. The most important points to keep in mind are the level of control we have over each individual polygon shape in regards to timing, position, easing and even tweening! That last point alone should be impressive enough for you to get started right this minute!
The Sky’s The Limit
As you can see with the previous animation examples, I’m generally moving the polygons in and out in a pulsating motion. Think about things like CSS perspective for a moment and the capabilities with 3D? What if each polygon shape folded? What if we started doing some weird skewing action or even blowing them up like the case is with the next demo (also used as a basis for the PolyMan above).