Created
February 4, 2022 04:56
-
-
Save zamfi/d03012d1bb6c7d5a98cb5d9c070ec10d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "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