W3Schools.com

HTML5 canvas arcTo Method

HTML5 track Tag Reference HTML5 canvas reference

Example

Draw a line with a long round corner:

Yor browser does not support the canvas tag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.moveTo(20,20);
ctx.lineTo(100,20);
ctx.arcTo(150,20,150,70,50);
ctx.lineTo(150,120);
ctx.stroke();

Try it yourself »

Definition and Usage

The arcTo method draws an arc between to points in the canvas.

Specify the two points and the arc's radius by using the five parameters.

JavaScript syntax: context.arcTo(x1,y1,x2,y2,r);


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The arcTo method is not fully suported in Opera.


Parameter Values

Parameter Values Description Play it
x1 x-coordinate The x-coordinate of the beginning of the arc Play it »
y1 y-coordinate The y-coordinate of the beginning of the arc Play it »
x2 x-coordinate The x-coordinate of the end of the arc Play it »
y2 y-coordinate The y-coordinate of the end of the arc Play it »
r radius The radius of the arc Play it »

HTML5 track Tag Reference HTML5 canvas reference


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE