English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
moveTo() ist eine Canvas 2D API verschiebt den Startpunkt eines neuen Unterpfades auf die Koordinaten (x, y).
Beginnen Sie einen Pfad, bewegen Sie sich in Position 0,0. Erstellen Sie eine Position 300,150 einer Linie:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Verwendung der HTML canvas moveTo() Methode-Grundtutorials(oldtoolbag.com)</<title> </<head> <body> <canvas id="myCanvas" width="300" height="150" style="Border:1px festes #d3d3d3"> Ihr Browser unterstützt keine HTML5 canvas-Tag. </canvas> <script> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.moveTo(0,0); ctx.lineTo(300,150); ctx.stroke(); </script> </body> </html>Test see ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 9Firefox, Opera, Chrome and Safari support moveTo() Method.
Note:Internet Explorer 8 And earlier versions do not support the <canvas> element.
The moveTo() method moves the path to the specified point on the canvas without creating a line.
Tip:Please use stroke() Method to draw an exact path on the canvas.
JavaScript Syntax: | context.moveTo(x,y); |
---|
Parameter | Description |
---|---|
x | The x-coordinate of the target location of the path. |
y | The y-coordinate of the target location of the path. |