Use HTML5 to draw the specific implementation code of a tank shape

Source: Internet
Author: User

Comments: I think you have already heard about HTML5. You can do a lot using HTML5. I will share with you the following code to draw a tank shape using html5, for more information, see
The Code is as follows:
Var canvas = document. getElementById ('mycanvas ');
Var ctx = canvas. getContext ('2d ');
Ctx. fillStyle = "#99FF66 ";
Ctx. fillRect (10, 10, 15, 80 );
// Ctx. fillRect (10, 80, 15, 80 );
Var canvas = document. getElementById ('mycanvas ');
Var ctx = canvas. getContext ('2d ');
Ctx. fillStyle = "#99FF66 ";
Ctx. fillRect (60, 10, 15, 80 );
Var canvas = document. getElementById ('mycanvas ');
Var ctx = canvas. getContext ('2d ');
Ctx. fillStyle = "# 0033CC ";
Ctx. fillRect (26,27, 33,50 );
Ctx. fillStyle = "red ";
Ctx. beginPath ();
Ctx. arc (, Math. PI * 2, true );
Ctx. closePath ();
Ctx. fill ();
Ctx. strokeTyle = "# CCCC00 ";
Ctx. lineWidth = 2;
Ctx. moveTo (43, 52 );
Ctx. lineTo (43, 10 );
Ctx. stroke ();

Related Article

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.