From the course: Advanced iOS App Development: Core Animation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution

Solution - iOS Tutorial

From the course: Advanced iOS App Development: Core Animation

Start my 1-month free trial

Solution

- [Voiceover] Alright, I'm gonna start off by refactoring the create firework to take in a color property. So we're going to accept UI colors, we're gonna call this firework color. Now instead of just the generic red, we're gonna set the color property to firework color. Now in the emitter cells, inside our emitter layer, I'm gonna create three different types, or colored, cells. I'm gonna say create firework with UI color red. Create firework with UI color orange. And create firework with UI color yellow. Now we also have to remember, as I keep drilling into you, that CG color is a must when you're dealing with layer color properties. Alright, now for the finishing touches. I'm gonna set the emission latitude property to 90 degrees. Which will set the z direction of the particle cell to sort of come at us. So I'm gonna set this to pi, divided by two. I'm also gonna set the fireworkscell.alphaRange, to, let's say, point eight. And the alpha speed, let's do the same, negative point one…

Contents