xxxxxxxxxx
74
function setup() {
createCanvas(441, 330);
}
//Establish Variables
let x1 = 0;
let x2 = 0;
let x3 = 0;
let i1 = 0;
let i2 = 0;
let i3 = 0;
//Establish Functions for Each Row of Bars
function barTop(){
noStroke();
fill(random(255), random(255), random(255));
rect(x1, 0, 63, 220);
x1 = x1 + 63;
}
function barMid(){
fill(random(255), random(255), random(255));
rect(x2, 220, 63, 30);
x2 = x2 + 63;
}
function barBot(){
fill(random(255));
rect(x3, 250, 73.5, 80);
x3 = x3 + 73.5;
}
function draw() {
//Initial Setup
while (i1 < 7) {
barTop();
barMid();
barBot();
i1 += 1;
i2 += 1;
i3 += 1;
}
//Top Bar Generation
if (i1 % 5 == 0){
barTop();
}
if (i1 % 35 == 0){
x1= 0;
}
i1 += 1;
//Middle Bar Generation
if (i2 % 7 == 0){
barMid();
}
if (i2 % 49 == 0){
x2 = 0;
}
i2 += 1;
//Bottom Bar Generation
if (i3 % 6 == 0){
barBot();
}
if (i3 % 36 == 0){
x3 = 0;
}
i3 += 1;
}