1. Computing

Discuss in my forum

Jennifer Kyrnin

Circles are Easy on an HTML5 Canvas

By , About.com GuideAugust 21, 2012

Follow me on:

Circles on a canvasWith just a few lines of JavaScript, you can draw colorful circles on the HTML5 CANVAS element. In this tutorial you will learn how to draw filled circles, half circles, and wavy lines made from stroked partial circles. The image in this blog post was first created in an HTML5 CANVAS, and I haven't shared the code for creating it. If you think you can recreate it, post a comment with either a URL where you've done it (in an HTML5 canvas, of course) or the JavaScript you would use to create a rainbow target on a canvas. All the tools you need are included in this article.

Read the full article: Drawing Circles on HTML5 Canvas

Learn More: HTML5 Canvas

Image © 2012 J Kyrnin - Licensed to About.com

Comments
September 1, 2012 at 8:47 pm
(1) John says:

var can = document.getElementById(“c1″),
ctx = can.getContext(“2d”),
startPoint = (Math.PI/180)*0;
endPoint = (Math.PI/180)*360;
radius = 13*6;
colors = ['red','orange','yellow','green','blue','indigo'];

for (i=0; i<colors.length; i++){
ctx.fillStyle=colors[i];
ctx.beginPath();
ctx.arc(80,80,radius,startPoint,endPoint,true);
ctx.fill();
radius-=13
}
ctx.fillStyle='#ec80ed';
ctx.beginPath();
ctx.arc(80,80,3,startPoint,endPoint,true);
ctx.fill();
ctx.closePath();

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
Top Related Searches circles canvas august 21

©2013 About.com. All rights reserved.