Answers for "how to add animation over image in Javascript"

-1

how to add animation over image in Javascript

function startAnimation() {
    var frameHeight = 102;
    var frames = 15;
    var frame = 0;
    var div = document.getElementById("animation");
    setInterval(function () {
        var frameOffset = (++frame % frames) * -frameHeight;
        div.style.backgroundPosition = "0px " + frameOffset + "px";
    }, 100);
}
Posted by: Guest on October-22-2020

Code answers related to "how to add animation over image in Javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language