I am currently working on an animation where I had to use setTimeout
to animate it.
Here is my html for the button "pause" which changes to resume on click:
<button type="button" id="pause">Pause</button>
Here is my JavaScript code where I am pausing the animation using the clearTimeout
and clearInterval
function of js.
document.getElementById("pause".addEventListener("click",function(){
toggleText();
clearTimeout(yT);
clearTimeout(gT);
clearTimeout(yTt);
clearTimeout(rsT);
clearInterval(sI);
I want to resume the animation from that very point where it was paused. I tried some functions suggested in other posts from Mr.Tim in this community but nothing is working out for me so far.