I want to make an iPhone app, programmed in Swift, that will change the flashlight between different intensities over time. The purpose of this is to replicate a flashlight with low battery.
I want it to be like a "timeline", where the intensity will fade between different intensities like this:
- At 0 minutes: 100%
- At 100 minutes: 0%
Now and then I would like the flashlight to flash a little to make it seem even more like a flashlight with low battery. It could be like this:
- At 30 minutes: 70%
- At 30 minutes and 1 second: 100%
- At 30 minutes and 2 seconds: 70%
- At 30 minutes and 3 seconds: 20%
- At 30 minutes and 6 seconds: 70%
I have read about how to turn the flashlight on here, and how to make a timer (using NSTimer) here, but I can't figure out how to combine them in order to make the flashlight intensity change over time.
What would be the best way to accomplish this?
Thank you in advance!