xxxxxxxxxx
40
let x = 0;
let y = 25;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(255);
let widinc = 20;
let heiinc = -20;
let wed = 100;
let hei = 200;
while (x <= windowWidth) {
let r = 0;
let g = random(255);
let b = random(255);
fill(r, g, b);
triangle(x, y, 50, 50, wed, hei);
wed += widinc;
hei += heiinc;
if (wed > 200 || wed < 100) {
widinc *= -1;
}
if (hei < 100 || hei > 200) {
heiinc *= -1;
}
x += 45;
}
y += 10;
x = 0;
fill(0);
textSize(12);
textAlign(LEFT);
text("P.S: if you stare too much, you might get dizzy:))",
width / 2,
height / 2 + 10
);
}