animation

英[??n??me??n] 美[??n??me??n]

n. 怒っている、活発、漫畫制作、漫畫撮影、[映畫とテレビ] アニメーション

複數形: animes

direction

英[d??rek?n] 美[d??r?k??n, da?-]

n. 方向、傾向、側面; 使用方法

複數形: 指示

css animation-direction屬性 構文

アニメーション方向屬性を使用するにはどうすればよいですか?

アニメーションの方向屬性は、アニメーションを順番に逆方向に再生するかどうかを定義するために使用されます。アニメーションが複數回再生される場合、アニメーションの値を設定することでアニメーションの順番を実現できます。 -方向を交互に切り替えます。逆方向に再生します。

関數: アニメーションを順番に逆方向に再生するかどうかを定義します。

構文: animation-direction:normal|alternate;

##説明: normal デフォルト値。アニメーションは正常に再生されるはずです。代替アニメーションは順番に逆になります。

注: アニメーションが 1 回だけ再生されるように設定されている場合、この屬性は効果がありません。

css animation-direction屬性 例

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s infinite;
animation-direction:alternate;

/* Safari and Chrome */
-webkit-animation:myfirst 5s infinite;
-webkit-animation-direction:alternate;
}

@keyframes myfirst
{
0%   {background:red; left:0px; top:0px;}
25%  {background:yellow; left:200px; top:0px;}
50%  {background:blue; left:200px; top:200px;}
75%  {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
0%   {background:red; left:0px; top:0px;}
25%  {background:yellow; left:200px; top:0px;}
50%  {background:blue; left:200px; top:200px;}
75%  {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}
</style>
</head>
<body>

<p><strong>注釋:</strong>Internet Explorer 9 以及更早的版本不支持 animation-direction 屬性。</p>

<div></div>

</body>
</html>

インスタンスの実行 ?

[インスタンスの実行] ボタンをクリックしてオンライン インスタンスを表示します