Animation How to - Rotate image animation








Question

We would like to know how to rotate image animation.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!-- www .j  ava2 s.c o m-->
  position: absolute;
}
div {
  position: relative;
  width: 200px;
  height: 200px;
  overflow: hidden;
}

img.a {
  -webkit-animation: mymove1 2s linear infinite;
}

img.b {
  -webkit-animation: mymove2 2s linear infinite;
}

@-webkit-keyframes mymove1 {
from { left:-200px;}
to {left: 0px;}
}

@-webkit-keyframes mymove2 {
from { left:0px;}
to {left: 200px;}
}
</style>
</head>
<body>
  <div>
    <img class="a" src="http://lorempixum.com/200/200/"> 
    <img class="b" src="http://lorempixum.com/200/200/">
  </div>
</body>
</html>

The code above is rendered as follows: