xxxxxxxxxx
44
let circleArray = [];
function setup() {
createCanvas(400, 400);
background(0);
noStroke();
//ARRAY
//push or insert data to the empty array
circleArray.push(100);
circleArray.push(200);
circleArray.push(300);
console.log(circleArray);
//OBJECT
let circleObject = {
x: 150,
y: height/2,
r: 50
}
console.log(circleObject);
fill(255, 0, 0);
circle(circleObject.x + 100, circleObject.y, circleObject.r);
}
function draw() {
//apply each pushed or inserted array data to circles
fill(250);
circle(circleArray[0], height/2, 50);
fill(210);
circle(circleArray[1], height/2, 50);
fill(150);
circle(circleArray[2], height/2, 50);
}