This page includes 2 different animations using pure CSS (i.e. no javascript) with some comments on how they’re set up. Hopefully it helps explain how CSS animations work (they’re used all over this website).
An animation using 5 objects (images) with only a single style change (opacity) to fade each object in and out.





Each image’s animation is staggered at 4 second intervals - there are 5 images so each is delayed by 1/5 (or 20%) of the animation duration:
img 4:
img 3:
img 2:
img 1: 
visible as they’re all stacked on top of each other
underneath (which hasn't started animating yet)
starts to fade out as the transparent (opacity 0) img 1
starts to fade in
is opaque and begins the 2nd animation loop from this point on, only the visible image is at opacity 1 - all the others are transparent (opacity 0)
starts to fade out as the transparent img 4
starts to fade inUsing just 1 object (a div), 2 animations are used to change 5 styles (location, rotation, width, background image & background colour) to move and change an image.
4px ; top: 4px}
4px ; top:106px ; transform:rotate(-450deg)}
4px ; top: 4px ; transform:rotate(-540deg)}
background-image:url(imgs/dice-1.png)}
background-image:url(imgs/dice-2.png)}
background-image:url(imgs/dice-3.png)}
background-image:url(imgs/dice-4.png)}
background-image:url(imgs/dice-3.png)}
background-image:url(imgs/dice-2.png)}
| site map / contents | website privacy |
| glossary | contact me |