Interactive Grids
Published in
3 min readSep 14, 2018
Create an interactive grid!
- Create a grid of a city, a floorplan or an elevation.
- Make sure one row or column of your grid changes to a different size.
- Nest a grid inside of your grid to add more complexity!
- Find a way to make your grid interactive!
Requirements
- Use a
while loop
i = 1
while i < 6:
print(i)
i += 1
- Use a
for loop
- Use a
logical operator
and #Returns True if both statements are true
or #Returns True if one of the statements is true
not #Reverse the result, returns False if the result is true
- Use interactivity with mouseX
mouseX
and mouseYmouseY
For more help, use this post on Interactivity or this post.
Posting to Medium
- Click the 3 dots at the top of the page. In the drop down menu, select “Add to Publication”. Select “Data Mining the City”.
- Click the green “Publish” dropdown at the top of the page. In this drop down you will need to add a tag “Research”. Then click “Publish”.
- After your publication is posted, Quentin and I will need to accept the draft. Once its accepted in will appear on the “Research” page of the Publication.
What to Post
- title — Name your grid and what it is: i.e. city, floor plan, elevation, etc
- image —sketch of what you are trying to make
- text — short description of the rules you are making
- image or gif — your Processing canvas
- code — post your code in a code block like this (use 3 back tics `` ` ):
#this is where your code should go
Simple Grid Example
size(900,1000)x = 80
y = 60
squareSize = 60
spacing = 10for column in xrange(0, 10):
for row in xrange(0, 10):
if column == 2 and row == 7:
fill(0, 255, 0)
else:
fill(255)
rect(x + column * (squareSize + spacing),
y + row * (squareSize + spacing),
squareSize,
squareSize)