Can you share some insights on how to pause and resume a CSS transition?
Check out the code below:
animationstate = "running";
function animate() {
if (animationstate == "running") {
deskppssystemdiv.style.transitionDuration = "2000ms";
deskppssystemdiv.style.transitionTimingFunction = "linear";
deskppssystemdiv.style.transform = "rotate(45deg)";
}
}
animate();
deskppssystemdiv.addEventListener("mouseenter", function(event) {
animationstate = "paused";
});
deskppssystemdiv.addEventListener("mouseleave", function(event) {
animationstate = "running";
});
Some suggestions I've come across include using the getComputedStyle
property or applying classes with addClass
and removeClass
, but I'm still figuring it out.