I've looked on w3schools and found this snippet of code for animating a transition between 2 colours:
@keyframes example {
0% {background-color:red; left:0px; top:0px;}
25% {background-color:yellow; left:200px; top:0px;}
50% {background-color:blue; left:200px; top:200px;}
75% {background-color:green; left:0px; top:200px;}
100% {background-color:red; left:0px; top:0px;}
}
and
div {
width: 100px;
height: 100px;
position: relative;
background-color: red;
animation-name: example;
animation-duration: 4s;
animation-iteration-count: infinite;
}
In order to animate a transition between 4 images I adapted into this:
@keyframes graphic {
from {img src="Scene1.jpg" alt="Scene1";}
to {img src="Scene2.jpg" alt="Scene2";}
to {img src="Scene3.jpg" alt="Scene3";}
to {img src="Scene4.jpg" alt="Scene4";}
}
.animation {
width: 100px;
height: 100px;
position: relative;
background-color: red;
animation-name: graphic;
animation-duration: 20s;
animation-iteration-count: infinite;
}
and used it as a div for this:
<div class="animation">
animation
</div>
However, all this does is place the text "animation" onto the webpage. Am I adapting this incorrectly or is there another method for animating transitions between images?