animation-direction プロパティ
animation-direction プロパティは、CSS アニメーションの再生/逆再生を指定するプロパティです。
alternate や alternate-reverse 値の場合はanimation-iteration-count プロパティで再生回数を2回に指定した方がよいでしょう。
div:hover{
animation: mymove 2s 2;
animation-direction: alternate-reverse;
}
@keyframes mymove {
from {
}
to {
box-shadow: 10px 10px;
}
}
ページ内 Index
構文(Syntax)
CSS
animation-direction:[ normal | reverse | alternate | alternate-reverse | initial | inherit ];
DOM ( JavaScript )
object.style.animationDirection
object.style.animationDirection="[ normal | reverse | alternate | alternate-reverse | initial | inherit ]"
値(Values)
| Value | 摘要 |
|---|---|
| normal | 初期値(default値)。順方向に再生。 |
| reverse | 逆再生 |
| alternate | 順方向に再生した後に逆再生 |
| alternate-reverse | 逆方向に再生した後に順再生 |
| initial | 初期値に戻す。 |
| inherit | 親エレメントのプロパティを継承。 |
備考(Remarks)
| 初期値(Default value) | normal |
| 継承(Inherited) | no |
| 変化(Animatable) | no |
Example
animation-directionの例です。divエレメントにマウスポインターが乗ったときにmymoveというCSSアニメーションを逆再生します。
関連プロパティ
以下は関連するプロパティです。
| プロパティ | 概要 |
|---|---|
| animation | CSSアニメーションのプロパティを一括指定 |
| animation-delay | 実行までの待ち時間。 |
| animation-direction | 再生/逆再生の設定。 |
| animation-duration | CSSアニメーションの実行時間。 |
| animation-fill-mode | 実行時間外の動作。 |
| animation-iteration-count | 再生回数。 |
| animation-name | @keyframesセレクターで定義したCSS animation名。 |
| animation-play-state | 実行/停止かの設定。 |
| animation-timing-function | CSS animationの実行速度曲線。 |
