有沒有辦法讓HTML5 Canvas暫停/恢復?暫停和恢復HTML5畫布?
說我的代碼:
// Draw lines with decreasing widths
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();
}
在代碼的開始,我想暫停()的意思,我會告訴瀏覽器「確定你真的沒有浪費做任何的任何資源實際繪製「,我只是要告訴你的命令。然後循環後,我會打電話Resume()意思是「好吧,你可以開始畫他們現在」
btw沒有人知道是否有一個JavaScript的上下文對象的完整引用(我無法在谷歌找到它也沒有MDC ..)
上下文對象的完整引用在這裏:http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html – 2011-05-31 15:12:24
@Simon Sarris thxalot – Pacerier 2011-06-01 08:45:22