Is there any way to pause / resume for HTML5 canvas?
Tell my code:
for (i = 20; i > 0; i--)
{
var v=i*20
ctx.strokeStyle = "rgb("+v+", "+v+", "+v+")";
ctx.lineWidth = i;
ctx.beginPath();
ctx.moveTo(55, 20 + (20 - i) * 24);
ctx.lineTo(335, 20 + (20 - i) * 24);
ctx.stroke();
}
At the beginning of the code, I would like to use the Pause () value, I will tell the browser "Well, you do not need to spend resources on any actual drawing right now", I will just tell you the commands. Then after scrolling, I will call Resume (), which means "ok, you can start drawing them now"
By the way, does anyone know if there is a full reference for the context object in javascript (I cannot find it in google or MDC ..)
source
share