Animation

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

n aspect tendance?;

propriété CSS de direction d'animation syntaxe

Comment utiliser l'attribut animation-direction ?

L'attribut animation-direction est utilisé pour définir si l'animation doit être jouée à l'envers à tour de r?le?; lorsque l'animation est jouée plus d'une fois, nous pouvons réaliser l'animation à l'envers en définissant la valeur d'animation-direction sur alterner.

Fonction?: Définissez si l'animation doit être jouée à l'envers à tour de r?le.

Syntaxe : animation-direction : normal|alternate;

Description : normal Valeur par défaut. L'animation devrait jouer normalement. alternative L'animation doit se relayer en sens inverse.?

Remarque?: Si l'animation est configurée pour être jouée une seule fois, cet attribut n'a aucun effet.

propriété CSS de direction d'animation exemple

<!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>

Exécuter l'instance ?

Cliquez sur le bouton ??Exécuter l'instance?? pour afficher l'instance en ligne