animation-directionプロパティ
animation-directionプロパティは、CSS animationの再生/逆再生を指定するプロパティです。
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; } }
関連プロパティ
以下は関連するプロパティです。
プロパティ | 概要 |
---|---|
animation | CSSアニメーションのプロパティを一括指定 |
animation-delay | 実行までの待ち時間。 |
animation-duration | CSSアニメーションの実行時間。 |
animation-fill-mode | 実行時間外の動作。 |
animation-iteration-count | 再生回数。 |
animation-name | @keyframesセレクターで定義したCSS animation名。 |
animation-play-state | 実行/停止かの設定。 |
animation-timing-function | CSS animationの実行速度曲線。 |
構文(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アニメーションを逆再生します。
関連(Related)
HTML、CSS、DOMのCSSアニメーションに関する用途一覧です。 CSSアニメーションができるかはCSSのプロパティによります。
HTML
CSS
DOM
- インターフェース
- AnimationEvent、 PopStateEvent
- イベント
- animationend、 animationiteration、 animationstart
- プロパティ
- animationName、 elapsedTime、 propertyName
- メソッド