transform rotate css animation code example
Example 1: css rotate animation
<img class="image" src="http://i.stack.imgur.com/pC1Tv.jpg" alt="" width="120" height="120">
.image {
position: absolute;
top: 50%;
left: 50%;
width: 120px;
height: 120px;
margin:-60px 0 0 -60px;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
Example 2: css transform
transform: matrix(1, 2, 3, 4, 5, 6);
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
transform: translate(120px, 50%);
transform: scale(2, 0.5);
transform: rotate(0.5turn);
transform: skew(30deg, 20deg);
transform: scale(0.5) translate(-100%, -100%);
transform: perspective(17px);
Example 3: transform rotate css
<!DOCTYPE html>
<html>
<head>
<style>
div.a {
width: 150px;
height: 80px;
background-color: yellow;
-ms-transform: rotate(20deg);
transform: rotate(20deg);
}
div.b {
width: 150px;
height: 80px;
background-color: yellow;
-ms-transform: skewY(20deg);
transform: skewY(20deg);
}
div.c {
width: 150px;
height: 80px;
background-color: yellow;
-ms-transform: scaleY(1.5);
transform: scaleY(1.5);
}
</style>
</head>
<body>
<h1>The transform Property</h1>
<h2>transform: rotate(20deg):</h2>
<div class="a">Hello World!</div>
<br>
<h2>transform: skewY(20deg):</h2>
<div class="b">Hello World!</div>
<br>
<h2>transform: scaleY(1.5):</h2>
<div class="c">Hello World!</div>
</body>
</html>