Created
February 6, 2020 16:50
-
-
Save douglasgoodwin/b2637ee85abfae57bd86d9eb3f98a2bd 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
size(400,400) | |
# white background | |
background(255) | |
textAlign(CENTER, CENTER) | |
i=0 | |
chunk=40 | |
# use range to specify the start, end, and chunk for each loop | |
# some inspiration from Shiffman | |
for y in range(0,height,chunk): | |
for x in range(0,width,chunk): | |
# fun with randoms! | |
# a random gray | |
boxfill = random(0,255) | |
fill(boxfill) | |
rect(x,y, chunk,chunk) | |
# how do we make this text readable? | |
txtfill = 255 - boxfill | |
fill(txtfill) | |
text("{}".format(i),x+chunk/2,y+chunk/2) | |
i= i+1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.evernote.com/l/ADPh2U51Ma1Lr7sxNYEpAQ7cT9nSrp8EaYUB/image.png