Easy Tutorial
❮ Tag Frame Att Frame Longdesc ❯

HTML canvas moveTo() Method

HTML canvas Reference Manual

Example

Begin a path, move to position 0,0. Create a line to position 300,150:

JavaScript:


Browser Support

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

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


Definition and Usage

The moveTo() method moves the path to the specified point in the canvas, without creating a line.

Tip: Use the stroke() method to draw the path on the canvas.

| JavaScript Syntax: | context.moveTo(x, y); | | --- | --- |

Parameter Values

Parameter Description
x The x-coordinate of the destination point of the path.
y The y-coordinate of the destination point of the path.

❮ Tag Frame Att Frame Longdesc ❯