HTML5 Dash, draw a circle

Source: Internet
Author: User

Dash Canvas

<script type= "Text/javascript" >

var C=document.getelementbyid ("MyCanvas");
var Cxt=c.getcontext ("2d");
Cxt.moveto (10,10);
Cxt.lineto (150,50);
Cxt.lineto (10,50);
Cxt.stroke ();

</script>

Draw Round Canvas

<script type= "Text/javascript" >
var C=document.getelementbyid ("MyCanvas");
var Cxt=c.getcontext ("2d");
Cxt.fillstyle= "#FF0000";
Cxt.beginpath ();
Cxt.arc (70,18,15,0,math.pi*2,true);
Cxt.closepath ();
Cxt.fill ();

</script>

Gradient

<script type= "Text/javascript" >

var C=document.getelementbyid ("MyCanvas");
var Cxt=c.getcontext ("2d");
var grd=cxt.createlineargradient (0,0,175,50);
Grd.addcolorstop (0, "#FF0000");
Grd.addcolorstop (1, "#00FF00");
CXT.FILLSTYLE=GRD;
Cxt.fillrect (0,0,175,50);

</script>

Image

<script type= "Text/javascript" >

var C=document.getelementbyid ("MyCanvas");
var Cxt=c.getcontext ("2d");
var img=new Image ()
Img.src= "Flower.png"
Cxt.drawimage (img,0,0);

</script>

HTML5 Dash, draw a circle

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.