Functions, Objects & Arrays in Processing

As part of my exploration of the program Processing, I’ve been trying to work out the differences between Functions, Objects, and Arrays. In this first example, I made a car Function, where I can basically use one Function that describes the size of the rectangle to draw, and the relationship of the ‘wheels’ to the body of the car. I can make the color independent and here I call the car function three times, each with a different color. I can also offset the placement of the three cars, but since all three are tied to the same function, they move at the same speed, at the same distance from each other.

Rather than treating the car as a function, I can make a car object. This allows me to make as many cars as I like, all moving independently. I also decided to animate the yellow stripe on the road.

Adding an Array to the sketch, I can now cycle through a series of cars of each color that also decreases in size and opacity from the original, with the idea of adding a motion blur effect. I was too lazy to add the blur effect to the tires.

Posted in Blog Entry, Education Tagged with:

Leave a Reply

Instant Audio

Most pieces can be auditioned on their post pages. But you can sample some audio here.

Quick Bio

CBG2_WPRKOriginally from New York, Charles Griffin returned to the U.S. in 2010 to take a position at Florida's Full Sail University as course director of Advanced Music Composition in their MPBS program, after spending 5 years living and working in Latvia. His compositions and arrangements have been performed at festivals and concert halls throughout the U.S., Canada, Mexico, Europe, Asia, Brazil, Cuba, and Puerto Rico.

He is also a radio show host on 91.5 WPRK FM. His show Zero Crossings incorporates live interviews with composers, conductors and performers with a focus on the local contemporary art music scene.

Read more in the biography section.