I am currently working on a website and I want to have an animation where the background changes color at certain points.
@keyframes background_color {
0% {
background: #dfdfdf;
}
15% {
background: radial-gradient(rgb(143, 50, 224, 0.6), #dfdfdf );
}
35% {
background: radial-gradient(rgb(143, 50, 224, 0.6), #dfdfdf );
}
50% {
background: #dfdfdf;
}
100% {
background: #dfdfdf;
}
}
The percents seem kind of weird, but they match with the movement of another animation. Basically, I want the color to change 9 times where it goes from default background to color change back to the default background and then repeat 9 times with different colors.
I tried java and other things like that, but I don’t know what to really do.
2
Answers
you can do this with css yes, and I can see that you forgot to add in "animation-duration".
try this:
you can read more here on how this work: https://www.w3schools.com/css/css3_animations.asp
In CSS, you can change 3 to 9.
And In javascript, you can change 16000 to 5 * 9 * 1000 + 1 – It’s waiting second.
Hope your success!!!