ข้อมูลอ้างอิง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 canvas arcTo() Method

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

ตัวอย่าง

สร้างส่วนโค้งระหว่างสองแทนเจนต์บนผืนผ้าใบ:

YourbrowserdoesnotsupporttheHTML5canvastag.

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

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20, 20);           // Create a starting point
ctx.lineTo(100, 20);          // Create a horizontal line
ctx.arcTo(150, 20, 150, 70, 50); // Create an arc
ctx.lineTo(150, 120);         // Continue with vertical line
ctx.stroke();                // Draw it

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

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

Method
arcTo() Yes 9.0 Yes Yes No

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

วิธี arcTo() สร้างส่วนโค้ง/เส้นโค้งระหว่างสองแทนเจนต์บนผืนผ้าใบ

ผ้าใบ arcto() ไดอะแกรม

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

ไวยากรณ์ JavaScript: บริบท .arcTo( x1,y1,x2,y2,r );

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

Parameter Description Play it
x1 The x-coordinate of the first tangent
y1 The y-coordinate of the first tangent
x2 The x-coordinate of the second tangent
y2 The y-coordinate of the second tangent
r The radius of the arc

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