I am looking to optimize the performance of an infinite gradient animation by introducing a pause. This animation was generated using to allow web browsers to take a break from constant color transitions.
Below is a script showcasing the mentioned animation:
.css-selector {
background: linear-gradient(270deg, #3adab1, #3a7bda, #853ada);
background-size: 600% 600%;
-webkit-animation: AnimationName 30s ease infinite;
-moz-animation: AnimationName 30s ease infinite;
animation: AnimationName 30s ease infinite;
}
@-webkit-keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
@-moz-keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
@keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
Is there a way to modify this CSS to implement a pause feature? Any guidance on achieving this would be highly appreciated!
I came across a suggestion on this site, mentioning the possibility of toggling between 'paused' and 'running' states. I'm uncertain about how to apply this concept here specifically. After researching on Google and Stackoverflow, I ended up creating this post.