Skip to content Skip to sidebar Skip to footer

Toggle SetLineDash()

I looked up how to draw dashed lines with the HTML5 canvas and discovered setLineDash(). It appears to work just fine in my browsers (Chrome, Firefox, and Safari) but I was not abl

Solution 1:

Each CanvasDrawingStyles object has a dash list, which is either empty or consists of an even number of non-negative numbers. Initially, the dash list must be empty.

Dash list starts as an empty array [], and thus you should set it to an empty array to reset the dash list to its initial state.

See also the setLineDash definition which also notes that the dash list defaults to empty.

  void setLineDash(sequence<unrestricted double> segments); // default empty

Post a Comment for "Toggle SetLineDash()"