Hey all, i have trouble to make background image change, i need animation with duration of 3s and delay of 3s , so 3s of image and than 3 s where will first image will go from opacity 1 to opacity 0 and at same time image 2 will start from opacity 0 to opacity 1. I think i am trying to do it wrong way but problem with my code is , i have white screen before images change
html
<div class="homepage" id="homepage"> </div>
css
.homepage {
background-image: url("/assets/img/Homepage-cover-v5.png");
background-position: center;
background-size: cover;
background-attachment: fixed;
height: 100vh;
width: 100%;
}
js
function slider() {
const SLIDER = gsap.timeline({
default: {
ease: "ease.in",
},
});
SLIDER.to(".homepage", {
delay: 3,
ease: "ease.in",
keyframes: [
{
duration: 1,
opacity: 1,
backgroundImage: "url(/assets/img/Homepage-cover-v5.png)",
},
{
duration: 1,
opacity: 0.5,
backgroundImage: "url(/assets/img/Homepage-cover-v5.png)",
},
{
duration: 1,
opacity: 0.2,
backgroundImage: "url(/assets/img/Homepage-cover-v5.png)",
},
],
keyframes: [
{
duration: 1,
opacity: 0.5,
backgroundImage: "url(/assets/img/pocetna3.png)",
},
{
duration: 1,
opacity: 0.5,
backgroundImage: "url(/assets/img/pocetna3.png)",
},
{
duration: 1,
opacity: 1,
backgroundImage: "url(/assets/img/pocetna3.png)",
},
],
backgroundImage: "url(/assets/img/pocetna3.png)",
});
}
slider();