Recently, I've been working on a basic keyframe animation. The animation is set to blink truck lights:
animation: blink-truck-lights .4s 8s 10s steps(2) 2 forwards;
@keyframes blink-truck-lights {
from{background-position: 0px 0;}
to{background-position: 0px -250px;}
}
Next, let's take a look at the JavaScript portion:
setInterval(function(){
$('#truck').addClass('blink-truck-lights');
},500);
setInterval(function(){
$('#truck').removeClass('blink-truck-lights');
},800);
My goal is to make this animation play over a specific interval of about 8 seconds. Initially, I thought of adding and removing the class with the animation syntax, but when I attempted to use setInterval for that purpose, the animation didn't start as expected.