Ellipse
Draw an Ellipse by providing its center co-ordinates, major and minor axis.
Ellipse is a plane curve surrounding two focal points, such that for all points on the curve, the sum of the two distances to the focal points is a constant.
You can change all the basic properties like stroke and fill.
Syntax
new ellipse(cx, cy, rx, ry, fill, fill_opacity, stroke, stroke_width);
Parameters
cx | Number : x-coordinate of the center |
cy | Number : y-coordinate of the center |
rx | Number : length of semi-horizontal axis of the ellipse |
ry | Number : length of semi-vertical axis of the ellipse |
fill | Color : fill color of the ellipse |
fill_opacity | Number [0 to 1] or percentage: fill opacity of the ellipse |
stroke | Color : stroke color of the ellipse |
stroke_width | Number : stroke width of the ellipse |
Example
new ellipse(WIDTH/2-50, HEIGHT/2, 70,50, "#E089B1", 0.1, "#E089B1", 2);
new ellipse(WIDTH/2+50, HEIGHT/2,50, 70, "#695FE6", 0.5, "#695FE6", 4);
t=0;
function draw(){
clearCanvas();
new ellipse(WIDTH/2-50, HEIGHT/2, 90*abs(sin(t)),60, "#E089B1", 0.1, "#E089B1", 2);
t+=0.01;
requestAnimationFrame(draw);
};