Monday, October 29, 2012

Oct 27-Processing

Introduction:
This week, we were practicing using Processing. Processing is a Java based programming language that is especially helpful when producing graphs, images, and animations. Our assignment was to create some sort of image that involved an animation or interaction with either the mouse or keyboard. After thinking about what we wanted to create, we decided to go with an all time favorite-the head tilting Corgi. For those of you who may not be familiar with this phenomenon, here's a video:



Procedure:
The first step in creating our Corgi animation was to actually create our Corgi. We started by looking at various pictures of Corgwn to get a good idea of what shapes we would need to use. Next, we began to sketch out the shapes and how we wanted them oriented. Since neither I nor my partner are particularly talented artists, this took a while...

After we had sketched out how we wanted our Corgi to look, we started working within Processing to make our shapes and build our Corgi. We used a combination of rectangles, ellipses, and curves to make the basic structure.

After construction a Corgi that we were satisfied with, we decided it was time to make the animation. Originally we applied a rotation function directly to the head, using the mouseX and mouseY to determine how the head should be tilted. However, this made it to where the Corgi's head would tilt at odd angles and even entirely upside down. We also had issues with other parts of the Corgi rotating.

To solve the first problem, we introduced upper and lower limits to our Corgi's head. This prevents his head from tilting more than 90 degrees or PI/2 in either direction.

To fix the second issue, we wrapped our rotation in a pushMatrix and popMatrix. This isolates the rotation to only the head.

After our head tilt was working properly, we decided to make the enhancement that attaches a bone to the cursor. While functionally it has no purpose, it provides a cute visual enhancement to the program.

Here's a video of our program and our source code:




Conclusion:
This project, while a little silly, was a lot of fun and I really enjoyed being able to use Processing and create an interactive animation.

No comments:

Post a Comment