¡@

Home 

javascript Programming Glossary: linethickness

Create a realistic pencil tool for a painting app with HTML5 Canvas

http://stackoverflow.com/questions/10122553/create-a-realistic-pencil-tool-for-a-painting-app-with-html5-canvas

ctx canvas.getContext 2d painting false lastX 0 lastY 0 lineThickness 1 canvas.width canvas.height 600 ctx.fillRect 0 0 600 600 canvas.onmousedown.. y2 y1 error 0 de dy dx yStep 1 y y1 if y1 y2 yStep 1 lineThickness 5 Math.sqrt x2 x1 x2 x1 y2 y1 y2 y1 10 if lineThickness 1 lineThickness.. 1 lineThickness 5 Math.sqrt x2 x1 x2 x1 y2 y1 y2 y1 10 if lineThickness 1 lineThickness 1 for var x x1 x x2 x if steep ctx.fillRect..