propriété de direction d'animation CSS3


  Résultats de traduction:
Animation

英[dəˈrekʃn ] 美[dɪˈrɛkʃən, daɪ-]

n aspect tendance ;

propriété de direction d'animation CSS3syntaxe

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.

Lorsque l'animation est jouée plus d'une fois, nous pouvons définir la valeur de animation-direction pour qu'elle alterne afin de réaliser l'animation jouée à l'envers. Par défaut, la valeur de cet attribut est normale, ce qui signifie que l'animation est jouée normalement

propriété de direction d'animation CSS3exemple

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

Recommandations populaires

Maison

vidéos

Questions et réponses