I'm trying to make an animation with automatic image swapping using @keyframes
of css3
. I am copying and pasting the example code, but to no avail. The transition between the images is occurring in a "crazy" way. Look at the snippet.
The animation I want to do is DEMO 3 - with MULTIPAS IMAGES: LINK - DEMO 3
#cf {
position:relative;
height:281px;
width:450px;
margin:0 auto;
}
#cf img {
position:absolute;
left:0;
-webkit-transition: opacity 2s ease-in-out;
-moz-transition: opacity 2s ease-in-out;
-o-transition: opacity 2s ease-in-out;
transition: opacity 2s ease-in-out;
}
#cf img.top {
animation-name: fadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 2s;
animation-direction: alternate;
}
#cf img.left {
animation-name: fadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 2s;
animation-direction: alternate;
}
@keyframes fadeInOut {
0% {opacity:1;}
17% {opacity:1;}
25% {opacity:0;}
92% {opacity:0;}
}
#cf img:nth-of-type(3) {
animation-delay: 2s;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="estilo.css">
</head>
<body>
<div id="cf">
<img class="bottom" src="http://www.podagaita.com/img/fotos/imagem%20de%20aves%201.jpg"/><imgclass="top" src="https://peregrinacultural.files.wordpress.com/2009/08/imagem-266.jpg"/><imgclass="left" src="http://s3.amazonaws.savoir.com.br/cea.com.br/imagem/cadastrocqlv/imagem/cadastrocqlv-53440.jpg" />
</div>
</body>
</html>