Skip to content

Instantly share code, notes, and snippets.

@douglasgoodwin
Created February 6, 2020 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglasgoodwin/b2637ee85abfae57bd86d9eb3f98a2bd to your computer and use it in GitHub Desktop.
Save douglasgoodwin/b2637ee85abfae57bd86d9eb3f98a2bd to your computer and use it in GitHub Desktop.
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