How can I animate a section color smoothly using css?
I am using wix studio
I have been trying to animate a section background to change color from a trigger ( Clicking on a video), fortunately I am successful on animating it… However, The animation has no steps and animates only with the provided keyframes so its blocky instead of smooth.
I have already tried setting the animation to ease and Linear and specifying steps() and nothing changes…
How can I fix this?
Here is the code that I have used:
(Trigger works and animation triggers)
css:
.section5{
animation: aw 1.2s steps(10);
animation-fill-mode: forwards;
transition: ease-in-out;
}
@keyframes aw{
0% {
--bg-overlay-color: rgb(154 162 173);
}
50%{
--bg-overlay-color: rgba(154, 162, 173, 0.2);
}
100%{
--bg-overlay-color: rgba(0, 0, 0, 0);
}
}
js:
$w('#videoBox1').onPlay((event) => {
//$w("#box4").style.backgroundColor = "white";
//$w("#box4").style.
let currentTime = $w("#videoBox1").currentTime;
//console.log(currentTime);
if (currentTime <= 0){
$w("#section5").customClassList.toggle("section5")
}
});