Skip to main content
added 30 characters in body; edited title
Source Link
user1430
user1430

Why does my HTML5 Masking Slow in Game Loopgame loop (with masking) run slowly?

I have a game loop like so:

setInterval(function() { context.save(); context.rect(26, 144, 745, 400); context.clip(); context.drawImage(myImage, 100, 100, 900, 900); context.restore(); }, 40);

setInterval(function()  
{  
    context.save();  
    context.rect(26, 144, 745, 400);  
    context.clip();  
    context.drawImage(myImage, 100, 100, 900, 900);  
    context.restore();  
}, 40);

As it runs the canvas gradually slows down to a stop. If I put the drawImage outside of the clipping then it runs indefinitely at the correct speed. Is there something I'm doing wrong?

HTML5 Masking Slow in Game Loop

I have a game loop like so:

setInterval(function() { context.save(); context.rect(26, 144, 745, 400); context.clip(); context.drawImage(myImage, 100, 100, 900, 900); context.restore(); }, 40);

As it runs the canvas gradually slows down to a stop. If I put the drawImage outside of the clipping then it runs indefinitely at the correct speed. Is there something I'm doing wrong?

Why does my HTML5 game loop (with masking) run slowly?

I have a game loop like so:

setInterval(function()  
{  
    context.save();  
    context.rect(26, 144, 745, 400);  
    context.clip();  
    context.drawImage(myImage, 100, 100, 900, 900);  
    context.restore();  
}, 40);

As it runs the canvas gradually slows down to a stop. If I put the drawImage outside of the clipping then it runs indefinitely at the correct speed. Is there something I'm doing wrong?

Source Link
Harold
  • 570
  • 4
  • 14

HTML5 Masking Slow in Game Loop

I have a game loop like so:

setInterval(function() { context.save(); context.rect(26, 144, 745, 400); context.clip(); context.drawImage(myImage, 100, 100, 900, 900); context.restore(); }, 40);

As it runs the canvas gradually slows down to a stop. If I put the drawImage outside of the clipping then it runs indefinitely at the correct speed. Is there something I'm doing wrong?