English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
arc() ist eine Canvas 2D API bietet eine Methode zum Zeichnen eines Bogenpfades. Der Mittelpunkt des Bogenpfades liegt an der Position (x, y), der Radius beträgt r, und der Bogen wird vom startAngle (standardmäßig im Uhrzeigersinn) beginnend und bis zum endAngle gezeichnet.
Zeichnen Sie einen Kreis:
<!DOCTYPE html> <html> <head> <meta charset="utf-8> <title>Verwendung des HTML canvas arc() Methods-Grund教程(oldtoolbag.com)</<title> </<head> <body> <canvas id="myCanvas" width="300" height="150" style="border:1px fest #d3d3d3> Ihr Browser unterstützt keine HTML5 canvas-Tag. </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.arc(100,75,50,0,2*Math.PI); ctx.stroke(); </script> </body> </html>Testen Sie, ob ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 9und Safari unterstützen arc() Methode.
Hinweis:Internet Explorer 8 Versionen bis einschließlich und vorher unterstützen das <canvas>-Element nicht.
Die Methode arc() erstellt einen Bogen./curve (used to create a circle or part of a circle).
Tip:If you create a circle using arc(), perform the following operation: set the start angle to 0, and set the end angle to2 * Math.PI.
Tip:Please use stroke() orfill() Method to draw the actual arc on the canvas.
JavaScript syntax: | context.arc(x,y,r,sAngle,eAngle,counterclockwise); |
---|
Parameter | Description |
---|---|
x | X-coordinate of the center of the circle. |
y | Y-coordinate of the center of the circle. |
r | Radius of the circle. |
sAngle | Start angle, in radians (the circular three o'clock position is 0 degrees). |
eAngle | End angle, in radians. |
counterclockwise | Optional. Specifies whether the drawing should be drawn clockwise or counterclockwise. False = clockwise, true = counterclockwise. |