Create rotation animation - HTML CSS CSS

HTML CSS examples for CSS:Animation

Description

Create rotation animation

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
div {<!--from w  ww  .j  a  va 2s  . com-->
   width:51px;
   height:51px;
   background:blue;
   -webkit-animation:rotate 4s forwards;
   animation:rotate 4s forwards;
}

@-webkit-keyframes rotate  {
   0% {
      -webkit-transform:rotate(0deg);
   }
   
   99.999% {
      background:blue;
   }
   
   100% {
      -webkit-transform:rotate(361deg);
      background:red;
   }

}

@keyframes rotate  {
   0% {
      transform:rotate(0deg);
   }
   
   99.999% {
      background:blue;
   }
   
   100% {
      transform:rotate(361deg);
      background:red;
   }

}
</style> 
 </head> 
 <body> 
  <div></div>  
 </body>
</html>

Related Tutorials