xxxxxxxxxx
71
//Random colors and sizes, within the arrays are called within each square, using random() inside of for loop statements. The for loop statements control/ determine the movement of the inner squares.
// I weighed the center value of the inner squares to be twice as likely within the size arrays, to give the impression of an more ordered choas.
// Color Pattern Arrays
let colors1 = ["#ffbe0b","#fb5607","#ff006e", "#8338ec", "#3a86ff"
];
let colors2 = ["#ef476f", "#ffd166", "#06d6a0", "#118ab2","#073b4c"];
// Size Increment Arrays
let VerticalAxisTop = [100,120,100,80];
let VerticalAxisTop2 =
[100,130,100,70];
let HorizontalAxisBottom = [300,320,300,280];
let HorizontalAxisBottom2 = [300,330,300,270];
function setup() {
createCanvas(400, 400);
rectMode(CENTER);
frameRate(1);
saveGif("output.gif", 20);
}
function draw() {
generateArt();
}
function generateArt() {
background("#d8f3dc");
// Top Left Square
for (i = 0; i < random(1000, 10000); i++){
fill(random(colors1));
square(100,100,190);
fill(random(colors2));
square(100,random(VerticalAxisTop),100);
}
// Top Right Square
for (i = 0; i < random(1000, 10000); i++){
fill(random(colors2));
square(100,300,190);
fill(random(colors1));
square(random(VerticalAxisTop2),300,100);
}
// Bottom Right Square
for (i = 0; i < random(1000, 10000); i++){
fill(random(colors1));
square(300,300,190);
fill(random(colors2));
square(300,random(HorizontalAxisBottom),100);
}
// Bottom Left Square
for (i = 0; i < random(1000, 10000); i++){
fill(random(colors2));
square(300,100,190);
fill(random(colors1));
square(random(HorizontalAxisBottom2),100,100);
}
}