Clearing javascript canvas lineto with intersecting lines

I have a canvas that has several lines drawn with a mouse movement. I want the line to last only a few seconds before deleting myself. A bit like twisting a tape around where it has a given length. I use lineTo to draw lines in the canvas. Here I refer a little to the code.

Problem

I can clear the line using clearRect (), but this literally clears everything, and the problem is that if the line intersects, it also clears the intersecting area. here is my Fiddle click and drag in the lower right box:

http://jsfiddle.net/m2K5h/

clear rect would give me the following: enter image description here

In summary

clearRect , " " , . , - .

!!!!

+5
1

- . , , .

, , . , , , .

jsfiddle

- , , .

+8

All Articles