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.

Nightfall with darkening sky

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.

Black sky with falling snowflakes

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.

Bright sunrise and orange sky, with growing and shrinking sun

The full animation and source code can be viewed here (plays best in Safari):
Dynamic Cityscapes

Read more about this project’s progress here.

No Responses to “Dynamic Cityscapes”  

  1. No Comments

Leave a Reply