Easy Tutorial
❮ Prop Video Currenttime Prop Nav Online ❯

HTML canvas stroke() Method

Canvas Object

Example

Draw a path, forming the shape of the red letter L:

JavaScript:


Browser Support

Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the stroke() method.

Note: Internet Explorer 8 and earlier versions do not support the <canvas> element.


Definition and Usage

The stroke() method actually draws the path defined by moveTo() and lineTo() methods. The default color is black.

Tip: Use the strokeStyle property to draw in another color/gradient.

| JavaScript Syntax: | context.stroke(); | | --- | --- |


Canvas Object

❮ Prop Video Currenttime Prop Nav Online ❯