HTML canvas moveTo() Method
Example
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(25, 25);
ctx.lineTo(125, 125);
ctx.stroke();
Meaning
The moveTo() method moves the path to the specified point in the canvas, without creating a line.
Standard Syntax
JavaScript syntax:
context.moveTo(x,y);
Advertisement
Parameter Values
| Parameter | Description |
|---|---|
| x | Specifies the x-coordinate of where to move the path to. |
| y | Specifies the y-coordinate of where to move the path to. |