0

これを下のキャンバスで使用します。

var requestAnimFrame =  window.requestAnimationFrame || 
                        window.webkitRequestAnimationFrame || 
                        window.mozRequestAnimationFrame || 
                        window.msRequestAnimationFrame  ||  
                        window.oRequestAnimationFrame   || 
                        function(callback) {
                        window.setTimeout(callback, 1000/60);
                        };

下のレイヤーの上にあるキャンバスレイヤーにこれを使用しています:

function DrawSpawnAnimation() {


    anim();
}

 function anim() {

        ctxAnimation.drawImage(spriteSheet, ExplodeFrame * 100, 2740,100,100,explodeX,explodeY,100,100);

        if (ExplodeFrame < 5) {
            ExplodeFrame++;
            setTimeout(anim, 500);

        } 

      //alert("Show current frame of animation"); - this shows the animation works, it just does 
      // not show it one frame per half second.
    }

私の問題は、アニメーションが画面上でミリ秒単位でちらつくことです。下のキャンバスの更新がめちゃくちゃですか?

4

1 に答える 1