【CSS3リファレンス】animation-iteration-count - web design lab
にほんブログ村 デザインブログ Webデザインへ PVアクセスランキング にほんブログ村

【CSS3リファレンス】animation-iteration-count


【CSS3リファレンス】animation-iteration-count

こんにちは(・∀・)

CSS3で新しく追加されたプロパティをご紹介します。今回ご紹介するCSSプロパティはanimation-iteration-countです。

概要

animation-iteration-countプロパティを使用してアニメーションを繰り返す回数を指定する事ができます。


.sample {
  animation-iteration-count: infinite;
}
適用要素

ブロックレベル要素・インライン要素

指定できる値
数値
繰り返す回数を数値で指定
infinite
無限に繰り返す
初期値

ease

サンプル
HTML

<p class="demo">大きさが変わります。</p>
CSS

@-webkit-keyframes demo-anime {
  0% { width: 250px; }
  50% { width: 150px; }
  100% { width: 300px; }
}
@keyframes demo-anime {
  0% { width: 250px; }
  50% { width: 150px; }
  100% { width: 300px; }
}
.demo {
  -webkit-animation-name: demo-anime;
  -webkit-animation-duration: 2s;
  -webkit-animation-timing-function: linear;
  -webkit-animation-iteration-count: infinite;
  -webkit-animation-direction: alternate;
  -webkit-animation-delay: 1s;
  animation-name: demo-anime;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-delay: 1s;
}

サンプルのCSSはVendor-Prefixを使用した例も載せてあります。

Result

大きさが変わります。


にほんブログ村 デザインブログ Webデザインへ PVアクセスランキング にほんブログ村