开发者

Clearing stroke paths (within a loop) in HTML5 canvas

开发者 https://www.devze.com 2023-02-13 14:38 出处:网络
I\'m struggling to clear a canvas for 2 simple stroke paths. Example: http://dl.dropbox.com/u/104380/canvas-test-case.html

I'm struggling to clear a canvas for 2 simple stroke paths.

Example: http://dl.dropbox.com/u/104380/canvas-test-case.html

... I'm using the new

requestAnimFrame()  

by Paul Irish. But I don't think this should have any effect on Canvas contexts, as opposed to a setInterval. As far开发者_JAVA百科 as I know, I'm also correctly using beginPath() and recalling getContext() inside the render loop.

... problem is, the two original strokes are not clearing!

Any ideas?


this line...

context.clearRect(0,0,canvas.width,canvas.height);

should be

context.clearRect(0,0,canvas[0].width,canvas[0].height);
0

精彩评论

暂无评论...
验证码 换一张
取 消