After I created my 2D image of Cityscapes, I incorporated the use of variables and conditionals in my code to make the sketch more dynamic. For example, I made the sky change color and darken, as if nightfall had descended, and I made snowflakes fall at random during night time. I wrote a boolean statement called “getDark” and programmed the RBG colors in the background to change.
I used the random() function to draw snowflakes in various “random” sizes and to make the snowflakes fall in “random” order at different speeds. This created a very tranquil animated scene.
Next, I wanted to incorporate the use of the keyPressed() function in order to involve participation from the user in the animation. When the user presses a key, the “getDark” boolean is reversed and the sky becomes lighter as if it is sunrise. Also, I made the crescent moon evolve into a full sun, and the sun grows and shrinks in animation.
The full animation and source code can be viewed here (plays best in Safari):
Read more about this project’s progress here.