Chapter 16. Responsive Animation
Animation on the web is particularly nuanced, as we have to adjust our work to take into account bandwidth, code compatibility, and product design. In this chapter we’ll go over some techniques for creating a truly responsive scalable animation. We’ll also cover different ways of working with the animation to achieve positive user experiences and parity across our multidevice world.
Some Quick Responsive Tips
At the very least we should ensure that interaction also works well on mobile, but if we’d like to create interactions that take advantage of all of the gestures mobile has to offer, we can use libraries like ZingTouch or Hammer.js to work with swipe or multiple finger detection. With a bit of work, these interactions can all be created through native detection as well.
Responsive web pages can specify initial-scale=1.0
in the <meta>
tag so that the device does not wait the default 300 ms for a second tap before calling the action. Interactions for touch events must either start from a larger touch target (40×40 px or greater) or use @media(pointer:coarse)
, as support allows.
GreenSock and Responsive SVG
The number-one reason I use GSAP has to do with cross-browser support for SVG transforms. Stable SVG rotation is very cumbersome. In almost every browser, transform-origin
problems persist, and they are completely unsupported in IE. This problem is clearly exacerbated when attempting to use transforms in a responsive manner, as any small ...
Get SVG Animations now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.