JS uses canvas to draw lines, curves

Source: Internet
Author: User

<body> <!--artboards--//text appears when the browser is not supported<canvas id= "Canvas" style= "background-color:black;" > Your current version does not support </canvas> <script type= "Text/javascript" >//get the artboard .       varCanvas = document.getElementById (' Canvas '); Canvas.width= 1000; Canvas.height= 1000; //Get Context       varcontext = Canvas.getcontext (' 2d '); //set the color of a lineContext.strokestyle = ' Red '; //set the width of a lineContext.linewidth = 5; //Draw a lineContext.beginpath (); //starting pointContext.moveto (200, 200); //EndContext.lineto (500, 200);       Context.closepath ();       Context.stroke (); //Draw an arcContext.beginpath (); /** Params * Center x Coordinate * Center y coordinate * radius * start angle * End angle * direction, true counter clockwise false clockwise default false, no write indicates false*/Context.arc (200,200,100,0,math.pi/2,false);Context.closepath ();    Context.stroke (); Context.strokestyle= ' Red '; Context.arc (200,200,100,0,MATH.PI/2, True);Context.closepath ();   Context.stroke (); </script></body>

JS uses canvas to draw lines, curves

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.