Web Technology

Animation on the web made easy with Animate.css

Today I’ll introduce a animation “framework” for the Web. The web has evolved a lot since I first learn about web programming. In the past, you need to use javascript to move the elements pixel by pixel to render animation on the web. Now, with the help of CSS3, this has simplified a lot. But since different browsers has different pace of adoption of the CSS3, we have something called vendor prefix (-webkit, -moz etc), Which looks pretty ugly and bulky.

In addition, the css3 syntax could be hard to understand and memorize for busy code monkeys. To solve this problem a cool developer consolidated some commonly used transition effects in a library, which we can use with zero-effort.


You can visit their project website or the github page to get the latest code. It’s pretty easy to use it, the library is simply a bunch of CSS classes.
First you need to download the code and include in your project, load the css in your HTML:

Thinking in CSS3 animation

Animation in CSS3 is declarative (well…css is declarations), meaning that you declare the duration, transition effects, property to animate, delay etc,  in the CSS class. Then add to the DOM element as soon as you want the animation to start.

Hard-wire effect to the element in the HTML

Javascript is not required to make it work, for example you want your logo Fade-in when the webpage loaded, you can just add the 2 css class “animated” and “fadeIn” in the element, the animation will start once the element is loaded.

Dynamically animate an object

The below code use jQuery to handle add remove class

 Control the timing

If you open the animate.css, You’ll see that there’s already default for the  duration, delay. You can change that settings for each element individually. But if you arealso lazy like me, you can change the “animated” class (not modify the code, just override it). Here is my settings:

That’s it, Happy hacking!



Share your thoughts