How can I change the speed of a CSS animation?
I have animation:
img.rotate {
animation-name: rotate;
animation-duration: 1.5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
I have an rotating image at infinite. Now I want change the speed of rotation with JS. I tried:
$('img').css('animation-duration', '2s');
The duration changes the speed, but the animation reboot to framekey 0% (the first), but I just want the animation continue like nothing happened; I don't want to go back to 0%.
How can I do that?