Bonjour à tous,
Je n'arrive pas à trouver mon erreur sur l'animation d'un background.
Si je joue sur la couleur du background, cela fonctionne:
Code css : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 div.carre { width:100px; height:100px; background-color:red; -webkit-animation:couleur 2s infinite alternate; animation:couleur 2s infinite alternate; } @keyframes couleur { 0% {background-color:red; } 25% {background-color:yellow; } 50% {background-color:blue; } 100% {background-color:green; } } @-webkit-keyframes couleur /* Safari and Chrome */ { 0% {background-color:red; } 25% {background-color:yellow; } 50% {background-color:blue; } 100% {background-color:green; } }
Code html : Sélectionner tout - Visualiser dans une fenêtre à part <div class="carre"></div>
Mais si je désire utiliser une image en background, la première image s'affiche, mais aucune animation.
Code css : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 div.photo { width:200px; height:150px; background-image:url(fleur1.jpg); -webkit-animation:diapo 1s infinite alternate; animation:diapo 1s infinite alternate; } @keyframes diapo { 0% { background-image:url(fleur1.jpg);} 25% { background-image:url(fleur2.jpg);} 50% { background-image:url(fleur3.jpg);} 100% { background-image:url(fleur4.jpg);} } @-webkit-keyframes diapo /* Safari and Chrome */ { 0% { background-image:url(fleur1.jpg);} 25% { background-image:url(fleur2.jpg);} 50% { background-image:url(fleur3.jpg);} 100% { background-image:url(fleur4.jpg);} }
Code html : Sélectionner tout - Visualiser dans une fenêtre à part <div class="photo"></div>
Les images sont bien là dans le même répertoire.
Une idée, merci aux passionnés!
Partager