Starry night: Week 2 process

For my second week assignment I had to follow some instructions:

  • One element controlled by the mouse.

  • One element that changes over time, independently of the mouse.

  • One element that is different every time you run the sketch.

I decided to create a new concept and not to continue my self portrait since that would reduce my options. I focused on the concept of a night full o stars that appear in random places each time the sketch is opened. I used the background as a tool to make the randomized stars disappear over time by assigning it an alpha value of 20, therefore each time that 5 backgrounds accumulate on top of each other the previously drawn star would disappear from the screen and since I placed it (and the stars) within the draw function, the sketch is generating them on loop.

Starry night, first attempt to move the stars already randomly generated

Starry night, first attempt to move the stars already randomly generated

I mapped the canvas in order to create a change in the frame rate depending on the vertical position of the mouse, the “higher” the location in Y, the faster the stars would generate, and viceversa. As for the element controlled by the mouse I wanted to create a shooting star that was going to move towards the right side of the screen and at the same time move up.

I was able to generate a white (random size) circle but I was unable to make it move in the direction that I wanted. I realized that function was not in loop, since I placed it inside the mousePressed function.

Encountered a problem: The created shooting star is not moving the way that I intended

Encountered a problem: The created shooting star is not moving the way that I intended

After changing the location of the shooting star code to inside the draw function I was able to finally visualize the movement that I was planning from the shooting star.

Shooting star: Decision to generate a shooting star when the mouse is pressed

Shooting star: Decision to generate a shooting star when the mouse is pressed

You can find the final result in the following link: