ข้อมูลอ้างอิงHTML

HTML โดยตัวอักษร HTML ตามหมวดหมู่ รองรับ HTML Browser แอตทริบิวต์ HTML HTML Global Attributes เหตุการณ์ HTML HTML สี HTML Canvas HTML เสียง/วิดีโอ ชุดอักขระ HTML HTML Doctypes การเข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTML ข้อความ HTTP วิธี HTTP ตัวแปลง PX เป็น EM แป้นพิมพ์ลัด


อาร์ค ผ้าใบ HTML ()วิธี การ

❮ อ้างอิงผ้าใบ HTML

ตัวอย่าง

สร้างวงกลม:

YourbrowserdoesnotsupporttheHTML5canvastag.

จาวาสคริปต์:

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(100, 75, 50, 0, 2 * Math.PI);
ctx.stroke();

รองรับเบราว์เซอร์

ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่รองรับวิธีการนี้อย่างเต็มที่

Method
arc() Yes 9.0 Yes Yes Yes

ความหมายและการใช้งาน

วิธี arc() สร้างส่วนโค้ง/ส่วนโค้ง (ใช้สร้างวงกลมหรือบางส่วนของวงกลม)

เคล็ดลับ:การสร้างวงกลมด้วย arc(): ตั้งค่ามุมเริ่มต้นเป็น 0 และมุมสิ้นสุดเป็น 2*Math.PI

เคล็ดลับ:ใช้วิธีstroke()หรือ fill()เพื่อวาดส่วนโค้งบนผืนผ้าใบ

อาร์ค

ศูนย์
อาร์ค ( 100,75 ,50,0*Math.PI,1.5*Math.PI)
มุมเริ่มต้น
อาร์ค(100,75,50, 0,1.5 * Math.PI)
มุมสิ้นสุด
อาร์ค(100,75,50,0*Math.PI, 1.5*Math.PI )

ไวยากรณ์ JavaScript: บริบท .arc ( x,y,r,sAngle,eAngle,ทวนเข็มนาฬิกา );

ค่าพารามิเตอร์

Parameter Description Play it
x The x-coordinate of the center of the circle
y The y-coordinate of the center of the circle
r The radius of the circle
sAngle The starting angle, in radians (0 is at the 3 o'clock position of the arc's circle)
eAngle The ending angle, in radians
counterclockwise Optional. Specifies whether the drawing should be counterclockwise or clockwise. False is default, and indicates clockwise, while true indicates counter-clockwise.

❮ อ้างอิงผ้าใบ HTML