How to create roundish shapes in p5.js?

by tressie.damore , in category: Javascript , a month ago

How to create roundish shapes in p5.js?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by filiberto , a month ago

@tressie.damore 

To create roundish shapes in p5.js, you can use the ellipse() function. Here is an example of how to create a roundish shape using the ellipse() function:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  
  // Draw a roundish shape using the ellipse() function
  fill(255, 0, 0); // Set fill color to red
  ellipse(200, 200, 200, 100); // Draw an ellipse with x position 200, y position 200, width 200 and height 100
}


In this example, the ellipse() function is used to draw a roundish shape with an x position of 200, y position of 200, a width of 200, and a height of 100. You can adjust the parameters of the ellipse() function to create different roundish shapes with different sizes and positions.