An animation I made for my New Art Genres course. This is a rough copy I made to practice using objects and functions. The program can be run and tweaked using the source code here:
http://www.openprocessing.org/sketch/118751
A few key features:
- The car moves slightly up and down based on a sine function, and its wheels rotate using rotate(), pushMatrix() and popMatrix().
- The yellow lines of the road move from right to left. They then move from right to left, and are reset back to the right when they pass the left-hand side.
- The trees are placed in a random spot within the region of dirt, with a random width between 10 and 25. The height is then a function of the width. They then move from right to left, and are reset back to the right when they pass the left-hand side.
- The clouds are placed in a random spot in the upper-quarter of the screen. They are composed of three different circles whose size is based off the initial radius. The radius is a random number between 10 and 40. The color of the clouds are based off of a random number generator so that light clouds have a higher probability of appearing than dark clouds. The speed of the cloud across the sky is dependent on the size of the cloud and its color. Using the map function, clouds with a larger radius move slower than clouds of a smaller radius. Similarly, the darker the cloud, the slower it moves.
- The number of trees and the number of clouds vary depending on a random number generated at the initialization of the program. Each number of objects has a probability of occurring, based on which random number is generated.
- All of the colors were selected using images of roads and cars and closely inspecting the color of the pixels. Then the scenery’s color was selected using EasyRGB’s color scheme tool. (Link can be found in an earlier post).
I would like to clean up the code using arrays, which means I need to go learn more about arrays and start working on another iteration. You rock, sir.
I’d also like to add more flexibility with the randomness of the scenery. Maybe weather, or animals or changes in seasons or time of day. Maybe even a few new types of trees or a car passing.
(I also translated the coordinates to the center of the screen because inverse Cartesian coordinates makes a little more sense to me than the default system.)
In terms of concentrated effort in coding and in comprehensive posts like this on his class blog, this gentleman has been setting the standard…nay, raising the bar in my recent Beginning New Genres class. Thanks Josh.
