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:
- x: This parameter takes the x-coordinate of the ellipse.
- y: This parameter takes the y-coordinate of the ellipse.
- w: This parameter takes the width of the ellipse.
- h: This parameter takes the height of the ellipse.
- detail: It is the optional parameter which takes the number of radial sectors to draw as integer.
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) } |
chevron_right
filter_none
Output:

Reference: https://p5js.org/reference/#/p5/ellipse
Recommended Posts:
- CSS | ellipse () Function
- Check if a point is inside, outside or on the ellipse
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- PHP | min( ) Function
- PHP | pos() Function
- D3.js | d3.map.set() Function
- PHP | max( ) Function
- CSS | rgb() Function
- CSS | url() Function
- p5.js | hue() function
- D3.js | d3.rgb() Function
- p5.js | int() function
- PHP | Ds\Map get() Function
- PHP | key() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



