xxxxxxxxxx
35
function setup() {
createCanvas(500, 500);
frameRate(30)
}
let offset = 0.0;
let status = 0;
function draw() {
background(250, 255, 218);
chaos(mouseY);
if (mouseIsPressed) {
status = 1;
} else {
status = 0;
}
}
function chaos(s) {
if (status === 0) {
for (let y = 0; y < height; y = y + 40) {
for (let x = 0; x < width; x = x + 40) {
offset = offset + 0.1;
line(0 + mouseX, x + noise(offset) * (s/2), y + noise(offset) * (s/2), height);
}
}
} else {
for (y = 0; y < height; y = y + 20) {
for (x = 0; x < width; x = x + 20) {
offset = offset + 0.1;
noFill()
circle(y + noise(offset) * (s/20), x + noise(offset) * (s/20), mouseY/4);
}
}
}
}