Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use html5 to call drawing api to draw simple circles

Shulou Source: shulou.com Published: 2022-06-01 07:27:21 10月03日 Update

This article will explain in detail how html5 calls drawing api to draw simple circles. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

The code is as follows:

HTML5 draws a circle http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">$(document).ready(function(){var c=document.getElementById ("drawbox"); var draw=c.getContext ("2d"); / / gets a reference to the 2d content and calls the drawing API

Draw.fillStyle= "red"; / / Color draw.beginPath (); / / from the new painting draw.arc. / / Center x coordinates | Center y coordinates | diameter | start | PI is pi, Math.PI*2 is a circle | true is clockwise: counterclockwise, 0 is clockwise, draw.closePath (); / / end draw.fill () }) this is the end of the article on "how to use html5 to draw api to draw simple circles". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Circle drawing article content center coordinates more good practical code circumference pi article direction clockwise diameter knowledge counterclockwise color reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei Xiaomi vpn Redmi