J'ai une animation d'image-clé CSS qui est censé ressembler à de la neige. Il est défini pour durer 20 secondes et boucle infiniment, ce qu'il fait. Le problème est que lorsque l'animation atteint la fin après l'heure définie et redémarre, il s'agit en quelque sorte d'un redémarrage saccadé/maladroit.Comment rendre cette animation d'image-clé CSS fluide au redémarrage?
Y a-t-il un moyen de rendre la lecture plus fluide lorsque l'animation est en boucle, de sorte qu'elle ne semble pas redémarrer mais juste un flux constant?
body {
height: 100%;
/*background-color: #333;*/
background-color: #6b92b9;
background-image: url('http://i.imgur.com/BiSmXaq.png'), url('http://i.imgur.com/XHuy0NJ.png'), url('http://i.imgur.com/okpRxJU.png');
-webkit-animation: snow 20s linear infinite;
-moz-animation: snow 20s linear infinite;
-ms-animation: snow 20s linear infinite;
animation: snow 20s linear infinite;
}
@-webkit-keyframes snow {
0% {
background-position: 0px 0px, 0px 0px, 0px 0px
}
50% {
background-color: #b4cfe0
}
100% {
background-position: 500px 1000px, 400px 400px, 300px 300px;
background-color: #6b92b9;
}
}
@-moz-keyframes snow {
0% {
background-position: 0px 0px, 0px 0px, 0px 0px
}
50% {
background-color: #b4cfe0
}
100% {
background-position: 500px 1000px, 400px 400px, 300px 300px;
background-color: #6b92b9;
}
}
@-ms-keyframes snow {
0% {
background-position: 0px 0px, 0px 0px, 0px 0px
}
50% {
background-color: #b4cfe0
}
100% {
background-position: 500px 1000px, 400px 400px, 300px 300px;
background-color: #6b92b9;
}
}
@keyframes snow {
0% {
background-position: 0px 0px, 0px 0px, 0px 0px
}
50% {
background-color: #b4cfe0
}
100% {
background-position: 500px 1000px, 400px 400px, 300px 300px;
background-color: #6b92b9;
}
}
Cela fonctionne assez bien. Si vous cherchez vraiment la transition, vous pouvez le voir un peu, mais ce n'est pas suffisant pour être un problème. Merci! –
Vous pouvez ajouter animation-timing-function: facilité d'entrée; pour faciliter l'animation, ça devrait aussi aider. – Marco