xxxxxxxxxx
29
var starX = []; // creating a blank array
var starY = []; // creating a blank array
var starS = []; // creating a blank array
var starC = [];
function setup(){
createCanvas(1280,720);
background(0);
for(var i = 0; i<200; i++){ // this for loop will iterate 100 times ...
starX.push(random(0, 1280)); // adding a random value to the end array
starY.push(random(0, 720));
starS.push(random(2, 10));
starC.push(random(0,255));
}
}
function draw(){
background(0);
fill(255,255,0);
for(var i = 0; i<200; i++){ // this loop will iterate 100 times as well
fill(starC[i]);
ellipse(starX[i], starY[i], starS[i], starS[i]); // reading the values of the arrays
}
}