xxxxxxxxxx
57
let spacing, randomNum, x, y;
let seed = 100;
let colorArray = [
"lime",
"red",
"orange",
"cyan",
"yellow",
"purple",
"magenta",
];
function setup() {
createCanvas(windowWidth, windowHeight);
noStroke();
randomSeed(seed); //sets a random value for random to start with. If you want a certain color to always start first or like a design that comes up, you can always set that first
}
function draw() {
background(0, 5);
// randomSeed(seed);
randomNum = int(random(4));
let r = random(20, 200);
x = random(width);
y = random(height);
// console.log(randomNum);
let randColor = floor(random(colorArray.length));
fill(colorArray[randColor]);
if (randomNum) {
circle(x, y, r);
} else if (randomNum == 1) {
circle(x * 0.01, y, r);
} else if (randomNum == 2) {
circle(x, y * 0.1, r);
} else {
circle(x, y, r * 0.01);
}
x += spacing;
y += spacing;
}
function resizeWindow() {
resizeCanvas(windowWidth, windowHeight);
x = 0;
y = 0;
}
function mousePressed() {
seed = random(2000);
resizeCanvas(windowWidth, windowHeight);
background(0);
x = 0;
y = 0;
}