Animation How to - Create Scale, Fade and Spin animation








Question

We would like to know how to create Scale, Fade and Spin animation.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--  w ww.  ja v  a  2 s.  c  o m-->
  width: 100px;
  height: 100px;
  background: transparent;
  border: solid 10px blue;
  border-radius: 50%;
  border-top: solid 10px transparent;
  border-bottom: solid 10px transparent;
  -moz-animation-name: transformIn, fadeIn;
  -moz-animation-duration: 1s, 1s;
  -moz-animation-timing-function: ease-in, ease-in;
  -moz-animation-delay: 0, 0, 0;
  -moz-animation-iteration-count: infinite, 1;
  -moz-animation-direction: normal, normal;
  -moz-animation-fill-mode: forwards, forwards;
  -moz-animation-play-state: running, running;
}

@-moz-keyframes transformIn {
from { -moz-transform:scale(2)rotate(0deg);}
to {-moz-transform: scale(1) rotate(360deg);}
}
@-moz-keyframes fadeIn {
from { opacity:0.0;}
to {opacity: 1.0;}
}
</style>
</head>
<body>
  Only run in FF.
  <div></div>
</body>
</html>

The code above is rendered as follows: