Simple Graph Animation using only CSS3

In this tutorial we are going to see how to do a Graph Bar Animation using pure CSS3, no JavaScript used in this tutorial. Its very simple if you already good at CSS techniques.

Because we have used CSS3 in here, this script works only in Modern Browsers, especially If you are going to use IE then use IE10.

See the demo below: (Mouse over on the graph to see the animation):

We are not using JavaScript here, So the only way to trigger the Animation is to hover on it.

To make this animation effect very simple, I have used only images. Those bars its looks like animating is actually a full background image.

There are totally three layers (DIVs), holding three background images:

graph-bggraph-bars-01 graph-bars-02

Images are:

1. graph-bg.png
2. graph-bars-01.png
3. graph-bars-02.png
See the CSS and HTML Part:

CSS:

 HTML:

These backgrounds are controlled by z-index. And the animation is controlled by CSS3 Transitions: (transition: all 2s ease-out) . There is a one second time difference between the 1st DIV and the 2nd DIV.

So the Animation is nothing but reducing the height of the DIVs.

If you see the above CSS classes (.cover and .graph_bars_02) height is defined. (height : 251px;). When height is removed from the DIVs (ie., height: 0px), the transition effect will start work.

To do that here we have used :hover 

If you want to animate the Graph OnLoad of the Webpage. You have to use jQuery / JavaScript to trigger this effect.

 
To try out yourself,  here is the Download link: 

Download

Add a Comment

Your email address will not be published. Required fields are marked *