CSS3

プロパティ

animation-direction

  編集:2022.07.14 by T.A.

mdn

アニメーションの再生方法。

名前 animation-direction
<single-animation-direction>#
初期値 normal
適用対象 すべての要素
継承 されない
百分率 受容しない
算出値 リスト: 各アイテムは 指定されたキーワードを与える
正準的順序 文法に従う
アニメーション型 アニメート不可

animation-direction プロパティは、アニメーションを どの周回において逆再生させるか を定義する。アニメーションが逆再生されるときは計時関数も逆にされる。例えば、逆再生されたときの ease-in アニメーションanimation-timing-function の値が ease-in にされたアニメーション】は、ease-out アニメーションとして現れることになる。

以下のCSSが組み込んであります:

<single-animation-direction>
normal | reverse | alternate | alternate-reverse
normal
アニメーションのすべての反復は、指定どおりに(順方向に)再生される。
<DIV style="border:1px solid black;
 width:200px; height:50px;
">
 <DIV style="position:relative;
  width:25px; height:25px; background:red;
  left:0px; top:0px;
  animation-name:Test;
  animation-timing-function:linear;
  animation-duration:5s;
  animation-direction:normal;
 "></DIV>
</DIV>

reverse
アニメーションのすべての反復は、指定とは逆方向に再生される
<DIV style="border:1px solid black;
 width:200px; height:50px;
">
 <DIV style="position:relative;
  width:25px; height:25px; background:red;
  left:0px; top:0px;
  animation-name:Test;
  animation-timing-function:linear;
  animation-duration:5s;
  animation-direction:reverse;
 "></DIV>
</DIV>

alternate
アニメーションの各 周回のうち、奇数回目の反復は順方向に再生され、偶数回目の反復は逆方向に再生される。
<DIV style="border:1px solid black;
 width:200px; height:50px;
">
 <DIV style="position:relative;
  width:25px; height:25px; background:red;
  left:0px; top:0px;
  animation-name:Test;
  animation-timing-function:linear;
  animation-duration:5s;
  animation-direction:alternate;
 "></DIV>
</DIV>

<DIV style="border:1px solid black;
 width:200px; height:50px;
">
 <DIV style="position:relative;
  width:25px; height:25px; background:red;
  left:0px; top:0px;
  animation-name:Test;
  animation-timing-function:linear;
  animation-duration:5s;
  animation-direction:alternate;
  animation-iteration-count:2;
 "></DIV>
</DIV>

alternate-reverse
アニメーションの各 周回のうち,奇数回目の反復は逆方向に再生され、偶数回目の反復は順方向に再生される。
<DIV style="border:1px solid black;
 width:200px; height:50px;
">
 <DIV style="position:relative;
  width:25px; height:25px; background:red;
  left:0px; top:0px;
  animation-name:Test;
  animation-timing-function:linear;
  animation-duration:5s;
  animation-direction:alternate-reverse;
  animation-iteration-count:2;
 "></DIV>
</DIV>

注記: 反復の偶奇を決定する目的においては、回数は 1 から数えることに注意。


テスト
別画面で表示させて。
HTML:

ここに表示
HTML:

ここに表示
スクリプト:


スクリプト:



表示内容:
表示内容: