Home > database >  p5js pass an array of x y coordinates to ellipse function
p5js pass an array of x y coordinates to ellipse function

Time:05-18

in p5js you can draw a circle using ellipse(100,100,20) - is it possible to pass an array of [100,100,20] to the ellipse function?

this doesn't work:

var arr = [100,100,20];
ellipse((...arr));

CodePudding user response:

Why the double parentheses? Spread operator inside the double parentheses causes a syntax error.

ellipse((...arr));

ellipse(...arr);
  • Related