hedron
hedron

Reputation: 33

p5js pass an array of x y coordinates to ellipse function

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));

Upvotes: 1

Views: 314

Answers (1)

Rabbid76
Rabbid76

Reputation: 210909

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

ellipse((...arr));

ellipse(...arr);

Upvotes: 1

Related Questions