Keyframe animation transform, moving position - HTML CSS CSS Property

HTML CSS examples for CSS Property:transform

Description

Keyframe animation transform, moving position

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 {<!-- ww  w .j  av a  2s  . c o  m-->
   width: 100px;
   height: 100px;
   background: red;
   position :relative;
   -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
   animation: mymove 5s infinite;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
   0%   {-webkit-transform:  translate(0, 0)}
   5%  {-webkit-transform:  translate(10px, 10px)}
   75%  {-webkit-transform:  translate(10px, 100px)}
   100% {-webkit-transform:  translate(100px, 10px)}
   100% {-webkit-transform:  translate(0, 0)}
}
/* Standard syntax */
@keyframes mymove {
   0%   {transform:  translate(0, 0)}
   5%  {transform:  translate(10px, 10px)}
   75%  {transform:  translate(10px, 100px)}
   80% {transform:  translate(100px, 10px)}
   100% {transform:  translate(0, 0)}
}


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

Related Tutorials