Skip to content

Instantly share code, notes, and snippets.

@zamfi
Created February 4, 2022 04:56
Show Gist options
  • Save zamfi/d03012d1bb6c7d5a98cb5d9c070ec10d to your computer and use it in GitHub Desktop.
Save zamfi/d03012d1bb6c7d5a98cb5d9c070ec10d to your computer and use it in GitHub Desktop.
// "spaced colored squares" -- object edition
var squares = [];
function setup() {
colorMode(HSB);
noFill();
for (var x = 50; x <= 250; x = x + 50) {
squares.push({
x: x,
y: 150,
size: random(10, 40)
});
}
}
function draw() {
background(220);
for (var i = 0; i < squares.length; i = i + 1) {
var square = squares[i];
square.y -= 1;
stroke(40,100,100);
rect(square.x, square.y, square.size, square.size);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment