html 5 canvas drawing is slow! [closed]
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this questionI am making a web application which is similar to开发者_如何学Python paint. The problem that I am facing right now is that my drawing algorithm is awfully slow. Basically what I am doing is drawing a straight line between successive pixels that have been recorded with the mousemove event.
Is there a smarter/(less expensive) way to draw user created lines and curves using html 5 canvas?
EDIT: It is incredibly slow only when I am redrawing the strokes that were already on the canvas.
What you want to do conceptually should be incredibly fast. Since you won't give us the code, here:
http://jsfiddle.net/mXrNk/1/
If this is faster, use it as a starting point.
The slowness (what exactly is slow? Slow to load, or slow to render?) might be caused by the hardware acceleration in your browser. What's your browser/OS? I find that Safari 5 in OS X and IE9 in Windows 7 have the fastest draw rates because of their hardware acceleration. In Chrome, you'll have to turn it on in about:flags, and it is a bit finicky.
精彩评论