Created
November 20, 2019 02:52
-
-
Save duskvirkus/cd70df68b369e701236809730523364f to your computer and use it in GitHub Desktop.
Simple processing program to generate checker patterns.
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
int SIZE = 64; | |
int scale = 2; | |
void settings() { | |
size(SIZE, SIZE); | |
} | |
void setup() { | |
color c1 = color(255); | |
color c2 = color(0); | |
loadPixels(); | |
for (int i = 0; i < width; i++) { | |
for (int j = 0; j < height / scale; j++) { | |
for (int k = 0; k < scale; k++) { | |
int y = j * scale + k; | |
int index = i + y * width; | |
if (j % 2 == 0) { | |
pixels[index] = i % (scale * 2) < scale ? c1 : c2; | |
} else { | |
pixels[index] = i % (scale * 2) < scale ? c2 : c1; | |
} | |
} | |
} | |
} | |
updatePixels(); | |
save("checkers-" + SIZE + "-" + scale + ".png"); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment