Home > Web Front-end > H5 Tutorial > HTML5 tutorial calls the drawing api to draw a simple circle code sharing_html5 tutorial skills

HTML5 tutorial calls the drawing api to draw a simple circle code sharing_html5 tutorial skills

WBOY
Release: 2016-05-16 15:48:38
Original
1457 people have browsed it


Copy code
The code is as follows:


HTML5 draws a circle

<script><br>$(document).ready(function(){<br>var c=document.getElementById("drawbox");<br>var draw=c.getContext("2d"); //Get a reference to the 2d content and call the drawing API</p> <p>draw.fillStyle="red"; //Color<br>draw.beginPath(); //Draw again<br>draw.arc(50,50,50,0,Math.PI*2,true ); //Center x coordinate|Center y coordinate|Diameter|Start|PI is pi, Math.PI*2 is to draw a circle|true is clockwise direction: counterclockwise, 0 is clockwise, <br>draw.closePath() ; //End<br>draw.fill();<br>})<br></script>






Rendering

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template