CSS3とframe animationのサンプルとprefixfree.js

CSS3とframe animationのサンプル
prefixfree.jsを使ってプリフィックスなしにしている。 とても便利。
尚、もとのソースは...
http://coding.smashingmagazine.com/2011/05/17/an-introduction-to-css3-keyframe-animations/
からシンプルにしたものである。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS3 animation with prefixfree.js</title>
<script src="prefixfree.min.js"></script>
<style>
#container {
  width: 1080px;
  margin: 0 auto;
  overflow: hidden;
  padding: 50px 20px 0 20px;
}

#sun {
  background: #ffd630;
  width: 130px;
  height: 130px;
  position: absolute;
  border-radius: 70px;
  z-index: 2;
  bottom: 0;
  left: 340px;
}

@keyframes sunrise {
   0% {
    bottom: 0;
    left: 340px;
    background: #f00;
  }
 33% {
    bottom: 340px;
    left: 340px;
    background: #ffd630;
  }
   66% {
    bottom: 340px;
    left: 40px;
    background: #ffd630;
  }
 100% {
    bottom: 0;
    left: 40px;
    background: #f00;
  }
 }

#sun.animate {
  animation-name: sunrise;
  animation-duration: 10s;
  animation-timing-function: ease;
  animation-iteration-count: 1;
  animation-direction: normal;
  animation-delay: 0;
  animation-play-state: running;
  animation-fill-mode: forwards;
}

</style>
</head>
<body>
<div id="container">
  <h1>css3 frame-animation with prefixfree.js</h1>
  <div id="left">
      <div id="sun" class="animate"></div>
  </div>
</div>
</body>
</html>


コメント

このブログの人気の投稿

日本でコンピュータサイエンスを学ぶ難しさ

How to preview nif file on the ubuntu.