Skip to content

Instantly share code, notes, and snippets.

@douglasgoodwin
Last active February 5, 2020 19:37
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/84f3c77c9b4b2610e269c3fd4592c287 to your computer and use it in GitHub Desktop.
Save douglasgoodwin/84f3c77c9b4b2610e269c3fd4592c287 to your computer and use it in GitHub Desktop.
from random import randrange
size(600,600)
background(255)
strokeWeight(2)
rowheight = height/7
colwidth = width/6
for y in range(0,height+rowheight,rowheight):
y = y-90
for x in range(0,width+colwidth,colwidth):
x = x-90
fillcolr = color(randrange(255),randrange(255),randrange(255),50)
noFill()
noStroke()
# 1. draw a square in the center of the window
rect(x+100,y+100, 50,50)
# # 2. draw another square of the same size starting in the center of the first rectangle
rect(x+125,y+125, 50,50)
# # 3. draw a line from the NW corners
line(x+100,y+100,x+125,y+125)
# # 4. draw a line from the NE corners
line(x+150,y+100, x+175,y+125)
# # 5. draw a line from the SW corners
line(x+100,y+150, x+125,y+175)
# # 6. draw a final line from the SE corners
line(x+150,y+150, x+175,y+175)
# draw the planes
stroke(255)
fill(fillcolr)
rect(x+100,y+100, 50,50)
rect(x+125,y+125, 50,50)
quad(x+100,y+100, x+125,y+125, x+125,y+175, x+100,y+150)
quad(x+100,y+100, x+150,y+100, x+175,y+125, x+125,y+125)
quad(x+150,y+100, x+175,y+125, x+175,y+175, x+150,y+150)
quad(x+150,y+150, x+175,y+175, x+125,y+175, x+100,y+150)
@douglasgoodwin
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment