After getting started creating simple static drawings with P5, as you can check in my first Intro to Computational Media Post, it’s time to play with simple animations.
I added some fun interactions to my “Night in the City” sketch as you can check below:
In “Night in the City Animated” the main interactive/animated ideas are:
1. Every time you scroll the mouse from left to right, you change the background color from 0 to 255 (black to white) giving this impression that the night turns into morning.
2. Every time you reload the drawing (or the page — just refresh it and you will see) the stars appear in different positions, in an ever changing sky with random star positions and sizes.
3. Also, as you can see in the top of the antenna in my Empire State, there is an on/off red light. The circle becomes red every 1000 milliseconds and then goes of for the next 1000, repeating this function in a loop.
You can see the code in this link.