【CSS3リファレンス】animation-timing-function
こんにちは(・∀・)
CSS3で新しく追加されたプロパティをご紹介します。今回ご紹介するCSSプロパティはanimation-timing-functionです。
概要
animation-timing-functionプロパティを使用してアニメーションが変化するパターンを指定する事ができます。
.sample {
animation-timing-function: linear;
}
適用要素
ブロックレベル要素・インライン要素
指定できる値
- linear
- 一定速度で変化
- ease
- 少し減速して始まり少し減速して終わる
- ease-in
- 減速して始まる
- ease-out
- 減速して終わる
- ease-in-out
- 減速して始まり減速して終わる
初期値
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
大きさが変わります。