Circle
Draw a Circle, Circle is a closed figure that is the locus of all points in a plane that are at a given distance (radius) from a given point, the center of the circle.
You can change all the basic properties like stroke and fill.
Syntax
new circle(cx, cy, r, fill, fill_opacity, stroke, stroke_width);
Parameters
cx | Number : x-coordinate of the center |
cy | Number : y-coordinate of the center |
r | Number : radius of the circle |
fill | Color : fill color of the circle |
fill_opacity | Number [0 to 1] or percentage: fill opacity of the circle |
stroke | Color : stroke color of the circle |
stroke_width | Number : stroke width of the circle |
Example
new circle(WIDTH/2, HEIGHT/2, 70, "#E089B1", 0.1, "#E089B1", 2);
new circle(WIDTH/2, HEIGHT/2+50, 70, "#695FE6", 0.5, "#695FE6", 4);
new circle(WIDTH/2+100, HEIGHT/2, 70, "#F7BE93", 1, "#F7BE93", 2);
t=0;
function draw(){
clearCanvas();
for(i=0;i<360;i+=30){
ic=mapRange(i,0,360,0,1);
new circle(WIDTH/2+80*cos(degToRad(i+t)),HEIGHT/2+80*sin(degToRad(i+t)),20, `rgba(103, 93, 225,${ic})`, 0.4, `rgba(103, 93, 225,${ic})`, 1);
};
t+=1;
requestAnimationFrame(draw);
};