xxxxxxxxxx
39
function setup() {
createCanvas(510, 510);
let r = random(0, 255);
let g = random(0, 100);
let b = random(0, 255);
background(r / 2, g / 2, b / 2);
}
let sksize = 10;
let reclocV = 0;
let reclocH = 0;
let column = 2;
let row = 2;
let direction = 1;
function draw() {
noStroke();
if (direction == 1) {
if (reclocV < 510) {
rect(column, reclocV, 100, 1020);
reclocV++;
} else {
direction = 0;
column = column + 102;
reclocV = 0;
}
} else if (direction == 0) {
if (reclocH < 510) {
rect(reclocH, row, 1020, 100);
reclocH++;
} else {
direction = 1;
row = row + 102;
reclocH = 0;
}
}
fill(mouseX / 2, mouseX / 6 + mouseY / 6, mouseY / 2, 100);
}