Jump to content

When does the canvas get drawn in HTML5

Johnny L's Photo
Posted Nov 08 2011 07:30 AM
1697 Views

I'm not quite understanding the HTML5 Canvas and when the canvas actually gets drawn. I have tried a number of techniques but the canvas seems to always get drawn at the end. I wanted to draw a sequence of line segments and see each line segment get drawn but no matter what I have tried, the final result is all I ever see. For example:
context.lineTo(10,10);
context.lineTo(20,20);
context.stroke()
context.lineTo(30,50);
context.stroke();
Shows only the final result whereas I wanted to see the first line segment drawn followed by the second line segment drawn but I don't see anything until both line segments are drawn. I was thinking that the call to stroke would display the canvas at that point but that does not seem to be the case. A call to closepath did not seem to have any affect either. Can anyone give me some guidance on how this works? Thanks.

Tags:
0 Subscribe


0 Replies