Search code examples
createjseaseljs

Can't draw 1px line


createjs.Shape() with graphics setStrokeStyle(1) draws a 2px line instead of 1px. If you screenshot the JSfiddle output below, you will seee that the line is 2px tall.

http://jsfiddle.net/7fbr9yan/

How do I draw a 1px line?


Solution

  • The line that you draw in going in between two lines of pixels, so it's coloring both sides of it in grey instead of black. change your code to

    line.graphics.moveTo(20,74.5).setStrokeStyle(2).beginStroke("#000").lineTo(280,74.5);
    

    in order to draw over only one line of pixels.