mercredi 24 août 2016

JavaScript: requestAnimateFrame get faster

I have an animation with requesetAnimationFrame And when I replay it, it gets faster and faster until it gets invisible.

function tirer(){

    var missile=document.getElementById("missile");
    var currt= missile.currentStyle ||window.getComputedStyle(missile);
    if ( parseInt(currt.bottom)<700)
    missile.style.bottom=parseInt(missile.style.bottom)+20+"px";
    else
    alert ( "in top");


}
function animation (){
    tirer();
    requestAnimationFrame(animation);

}

How can I get it to be a stable, constant speed?

Aucun commentaire:

Enregistrer un commentaire