P5.js 3d arrays... is it possible?!

Hi there! Is it possible to make an array of spheres? like in WEBGL I am a bit confused.
thanks

Welcome, @m23d

I’m not sure exactly what you’re after here. Would an array to hold the sphere parameters work?

let spheres = [
  # x    y    fill     size
  [-100, 10, '#FF0000', 40],
  [0,    20, '#00FF00', 20],
  [100,  30, '#0000FF', 60]
]

function setup() {
  createCanvas(500, 500, WEBGL); 
}

function draw() {
  background(220);
  
  spheres.forEach((sp) => {
    push();
    translate(sp[0], sp[1]);
    fill(sp[2]);
    sphere(sp[3]);
    pop();
  });
}

Thanks! You have helped a lot!