homework 5

(a) create a looping fireworks animation (non interactive). You will need to reset or restart particles every so often. (and then we'll figure out how to save this as a screen saver for your mom!)
(b) since you know how to position things in a circle using the formula:
x = x_orig + radius * cos (angle);
y = y_orig + radius * sin (angle);
think about how you could use sinusoidal information to start all the particles with some interesting positions / velocities. Instead of using random, use sinusoidal information (in any way you want) to make the sarting positions/velocities of these objects interesting. can you use sin/cos to make the movement or drawing of the particle more interesting?

(c) Besides evidence to the contrary, particles don't have to be just circles! you can draw them however you want. Can you create an interesting effect with transparency or by using images? Can you use parameters, like velocity to control the way these objects are drawn (like, they get smaller as they slow down, or more transparent, using angle of the velocity to rotate, etc). Think about trying to create a natural phenomenon or make something really nice looking.

Shooting stars as particles:

Particles spinning out from the center:

For this one I tried to tackle all the homework challenges in one sketch. I started with one of the examples and I moved the code from mouse pressed into it's own function, so that instead of restarting the particles every time the mouse was clicked, I could have the function called from inside update. I then setit up so that when the alpha fades down to zero, it waits a short time and then calls the function. I did this using "sleep". Also, I added fireworks sound effects. The pitch and volume of the sound effects are changed randomly each time, as is the amount of time between explosions so that it seems a little more realistic. I also set it so that the fireworks only occur on the top half of the screen. Lastly, I altered the particl class so that it draws stars for each particle. I started messing around with push and pop matrix to make the stars turn so they weren't all oriented the same way. I was getting weird results and eventually gave up. I realise now that I was doing a few things wrong. First off, I was trying to do the push and pop matrix stuff in the particle class instead of in the test.app. Also, I didn't understand how to translate position before drawing. We talked a lot about this in class so now I get it, but I didn't go back to this code.

I also made a second sketch using sinusoidal information to throw the particles around the screen. When the sketch starts, it just does a pretty generic particle explosion, but when it updates it starts "throwing" particles out in a spiral from the center. I sort of did this by accident when I was experimenting with the code, but I liked it, so I kept it.