【CSS3リファレンス】animation-delay
こんにちは(・∀・)
CSS3で新しく追加されたプロパティをご紹介します。今回ご紹介するCSSプロパティはanimation-delayです。
概要
animation-delayプロパティを使用してアニメーションが再生するまでの時間を設定する事ができます。
.sample {
animation-delay: 2s;
}
適用要素
ブロックレベル要素・インライン要素
指定できる値
- 数値
- 時間を指定
単位はs(秒)、ms(ミリ秒)が指定できます。
初期値
0
サンプル
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
大きさが変わります。