4A Tues 9/25

PROGRAMMING (for loops, variable scope, custom functions)

  1. Loops: In the text book, do exercises 6.2,  6.3 and 6.4.
  2. Loops: Receding horizon. Using a loop and the line functions, create a set of vertical lines. Can you adjust each for loop to create a receding horizon, similar to the image below? 
  3. Functions: In your face. Take your face code and refactor it, implementing functions for each part. eg. eyes(); hair(); etc.
  4. Loops: A Mini-Calendar (for loops). Create a visual calendar. Use a for() loop to generate a row of visual elements: one for each of the days of the current month. All of the elements should be drawn identically, except for the one whose index corresponds to the current day. You will need to use the day() function. Differentiate this one in some way. This is one way it could look.

Homework: Iteration with Functions:

  • Exercises from Learning Processing: 7.4, 7.5 7.6, 7.7, 7.8
  • Extension: Write a function which encapsulates several drawing commands in order to render a simple element (a leaf, a face, a robot, a letter etc). Give your function arguments that determine where the element will be positioned. Using a for loop (or two), call your function to display a grid of these elements.

Reading

  • Technical Reading: Make sure you’ve read Chapter 6 and Chapter 7 in Learning Processing. OR// if you prefer video, see this playlist on loops by Shiffman. And this playlist on functions.
  • Read the introduction and Chapter 1 of Broadband, by the amazing Claire Evans. Not only is she the lead singer in Yacht, but she recently wrote this book on the history of the internet. (If you’re into it, keep going!). We will discuss this next week. Excerpt-BroadBand – ClaireL.Evans.