Name

CanvasRenderingContext2D.stroke( ): draw the current path

Synopsis

void stroke( )

Description

The stroke( ) method draws the outline of the current path. The path defines the geometry of the line that is produced, but the visual appearance of that line depends on the strokeStyle, lineWidth, lineCap, lineJoin, and miterLimit properties.

The term stroke refers to a pen or brush stroke. It means “draw the outline of.” Contrast this stroke( ) method with fill( ), which fills the interior of a path rather than stroking the outline of the path.

See Also

CanvasRenderingContext2D.fill( )
CanvasRenderingContext2D.lineCap
CanvasRenderingContext2D.lineJoin
CanvasRenderingContext2D.strokeRect( )

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.