Open In App

p5.js ellipse() Function

The ellipse() function is an inbuilt function in p5.js which is used to draw an ellipse.

Syntax:



ellipse(x, y, w, h)
ellipse(x, y, w, h, detail)

Parameters: This function accepts five parameters as mentioned above and described below:

Below program illustrates the ellipse() function in P5.js:






function setup() {
    createCanvas(400, 400);
}
  
function draw() {
    background(220);
    fill('yellow');
      
    // An ellipse at 150, 150 with radius 280
    ellipse(150, 150, 280, 180) 

Output:

Reference: https://p5js.org/reference/#/p5/ellipse

Article Tags :