You have to call context.closePath() when you've ended your blue line, and then call context.beginPath() and context.moveTo() again to start your new red line.
As it is now your red line uses all coordinates from the blue line as well those added after your first stroke(), so it draws the red line above the blue line.
Thanks.
However, I need a way to 'endPath' rather than 'closePath'. The problem with 'closePath()' is that it will create a triangle if I plot three points. How can join three points in one colour, and then join a succession of other points in another colour, without the first three points being made into a closed triangle through the use of 'closePath()'?
Bookmarks