Animation How to - Create CSS3 animated rotation on Image








Question

We would like to know how to create CSS3 animated rotation on Image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
@-webkit-keyframes rotate {<!--from   www .  j ava  2s .  co  m-->
    from { -webkit-transform:rotate(0deg);}
    to {-webkit-transform: rotate(360deg);}
}
.animation-rotate {
  -webkit-animation-name: rotate;
  -webkit-animation-duration: 1.5s;
  -webkit-animation-iteration-count: infinite;
  -webkit-transition-timing-function: linear;
}
</style>
</head>
<body>
    <img src="http://www.java2s.com/style/download.png"
      class="animation-rotate" />
</body>
</html>

The code above is rendered as follows: