I'm currently writing animations like so
function animate(element, angle, x, y){
var id = setInterval(frame, 5);
function frame() {
if (/* test for finished */) {
clearInterval(id);
} else {
/* change element style */
}
}
}
I can't do addEventListener("animationend", function(e){...})
since it's not a css animation, so how would I do something similar to detect the end of the animation on a specific element and run a different function following it like the addEventListener("animationend", function(){}) would do? Specifically, I want to create a function that takes in those parameters.