CSS3 transformation with Rotating gears example

Given a static image like this one

We might apply many kinds of transformations on it using CSS3 "transform" like rotate and scale, skew or any transformation matrix.

How to apply it ?
You can rotate gear by 120 degrees using the following css
.my_class {
You may scale to be 50% smaller using a similar sytax:
.my_class {

you may also specify different factor for X-axis and Y-axis using scale(X,Y);
You may specify two transformations like this
.my_class {
-webkit-transform:rotate(120deg) scale(0.5);
-mox-transform:rotate(120deg) scale(0.5);

Here is an example

How to animating it ?
we can use "@-moz-keyframes" and "@-webkit-keyframes" we have learned in a previous post titled creating CSS3 animations using something like

@-moz-keyframes ani {
  0% { -moz-transform:rotate(0) scale(1);}
 50% { -moz-transform:rotate(180deg) scale(0.5); }
100% { -moz-transform:rotate(360deg) scale(1); }
and here is the result

Live Demo

You can see the above rotating gear in jsfiddle here


Popular posts from this blog

DIY Docker using Skopeo+OStree+Runc

Multi-host docker cluster using OVS/VxLAN on CentOS 7

Bootstrapping Alpine Linux QCow2 image