Metal Toad has been building applications and cloud environments for some of the most well-known global brands for over a decade. Learn more > >

A quick look at CSS3 animations

CSS3 animations are finally becoming a useful tool in the front end developer's kit! Browser support is progressing, however there is no IE support yet (surprised?) and Opera currently doesn't support animations, but may in the future.

Despite the plethora of vendor prefixes to keep track of, one can really pull off some interesting animations; transforms and transitions anyone?

Check out the live demo at http://dabblet.com/gist/1867896/

The full demo is available over on dabblet.com if you want to play with the code, or grab a copy from github.

I know... I could have easily used images for the graphical elements and it's really an exorbitant amount of css to accomplish the goal, but where is the fun in that? There is also cpu/gpu use to take into account, but this little example isn't too heavy in that respect.

A couple of neat things about the animation:

  • Everything is html/css. No images. Yep, lots of divs/css, but no images. (Thanks Graeme Blackwood for the original css Druplicon, and Red Team Design for the css HTML5 logo)
  • @keyframes are super fun! Using percentages for steps, one can work through (I would guess) some very complex animations.
  • I did use a little JavaScript library, Lea Verou's -prefix-free to allow me to write plain css, without having to keep track of vendor prefixes. One could also use Prefixr afterwards to fill in the prefixes.

If you're using a modern browser and want to see a CSS3 transition in the wild, resize your browser! Our site uses transition: all 0.5s ease; to dress up the responsive layout transition.

Comments

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready to get started?