Mini Draw Loop

Draw something with the mouse. Release the mouse. It loops.

Golfed in 289 bytes.

<canvas id=c><script>t=c.getContext`2d`,
onmousedown=o=>(C=X=x,D=Y=y,m=1,P=[]),
onmouseup=e=>m=o=0,
onmousemove=o=>(x=o.offsetX,y=o.offsetY),
setInterval`for(m?(Z=P.push([x-X,y-Y]),X=x,Y=y,o=0):o++,
A=C,B=D,c.width^=i=0;i<o+Z;i++)e=P[i%Z],A+=e[0],B+=e[1],
i>o&&t.lineTo(A,B);t.stroke()`</script>