Home

Using the transform: & transition: attributes

TRANSFORM to scale/skew/rotate & reposition elements

TRANSITION to spin elements

Transform can be used to manipulate objects to change their :-
size eg transform:scale(n, n);
rotation eg transform:rotate(10deg);
skew eg transform:skew(20deg);
reposition eg transform:translate(20px, 30px);
perspective eg transform:perspective(1000px);

NOTE...
You do not have to have separate lines, you could say
transform:scale(1.5, 1.5) rotate(30deg) translate(20px, 20px)

Any adjustments leave the margin in its original position
it only really moves the CONTENT around.

Normal

Wile E Coyote

transform:scale(1.5, 1.5);

Wile E Coyote

transform:rotate305deg);

Wile E Coyote

transform:rotate(-30deg);

Wile E Coyote

transform:translate(10px, 20px);

Wile E Coyote

transform:translate(-10px, -20px);

Wile E Coyote

transform:translateX(-50%);
(this moves 50% of the image size to the left)

Wile E Coyote

transform:skewX(10deg, 10deg);

Wile E Coyote

transform:skewY(10deg);

Wile E Coyote

transform:skew(10deg, 10deg);

Wile E Coyote

Hover over the picture to see what happens
- transform: scale(2, 2) translate(75px, -25px)

Tweety Pie

transform:scale(1.5, 1.5) rotate(30deg) translate(40px, 20px);

Wile E Coyote



Changing the perspective can give it a 3D look...
Left image =
transform:perspective(750px)rotateY(65deg)scale(2.5, 1.5)translateX(50px);
Right image =
transform:perspective(1000px)rotateY(-65deg)scale(2.25, 1.25)translateX(50px);

Tweety Pie Tweety Pie

transform:scale(1.5, 1.5) rotate(30deg) translate(40px, 20px);

Wile E Coyote



TRANSITION (spin elements)

Hover over a picture to spin it
It's easier to look at the code rather than me list it here
1st = spin around centre
2nd = spin around Y axis
3rd = spin around X axis
and it's best to use a .png so the background is still visible.

Tweety Pie Tweety Pie Tweety Pie


Top