The Final Assignment!
I decided to continue working on my week 9 assignment and try to make it feel more like a Photobooth. I was thinking about the app that comes installed on macs when I was working on this.
The first thing I did was to find a sound file of a camera flash - there are tons of sample sounds online and I was able to find one that sounds like the iPhone camera and upload it into my sketch.
iphone-camera-capture-6448.mp3
I then was playing with what the trigger for the “photo-flash” moment would be. I tried to use the keyIsPressed function but it was not reliable. When I was in the editor and pressing keys in a controlled manner, it would only trigger every ~5th press. When I was in full screen mode, it would only respond to about every 10th key press. In the editor mode, the frame rate would reset so you could then take another picture, but in full screen mode it would not.
I then tried using the mousePressed function to trigger the camera. It reliably played the camera sound and froze the image, but I could not figure out how to get it to restart the image again using the same method as above.
I then discovered the mouseClicked and doubleClicked functions which ended up working perfectly with only a couple adjustments from above. I had to put the trigger for taking pictures in the doubleClicked function, because when they were reversed, the sound played every time I tried to reset the image as well.
Something else I wanted to include was a flash of white light when you take a picture, but could not figure out a way to make that work. Because I had a mixture of html/css in the background along with my JavaScript set up in the middle, it was hard figuring out how to make them both work.
I then realized this all might be easier with the addition of html/DOM elements, and that could also be used to include text instructions on how to use the photo-booth. This was probably my weakest topic we covered throughout the semester, so I knew it would be a challenge to get this to work how I wanted it to.