HTML canvas moveTo() method
Definition and usage
moveTo()
The method moves the path to the specified point on the canvas without creating a line.
Hint:Please use stroke() Method draws the exact path on the canvas.
Instance
Start a path, move to position 0,0. Create a line to position 300,150:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.moveTo(0,0); ctx.lineTo(300,150); ctx.stroke();
Syntaksi
context.moveTo(x,y);
Parametrien arvot
Parametrit | Kuvaus |
---|---|
x | Polun kohdepaikan x-akselin arvo |
y | Polun kohdepaikan y-akselin arvo |
Selaimen tuki
Taulukossa olevat numerot osoittavat ensimmäisen täysin tukevan selaimen version.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
Huomautus:Internet Explorer 8 ja aikaisemmat versiot eivät tue <canvas>-elementtiä.