Animating a Bouquet of Flowers
Welcome to the next project. Here, we will create a bouquet of flowers, animate the flower petals so they open and close, and then add a smoke/vapor effect to make it look like the flower is breathing by using the blur
modifier.
Behind the flowers, we will place a winter backdrop, and make it snow too by using the CAEmitter
class. The CAEmitter
class is a UIKit class that was built for animation, but to be able to access it, we will need to use a SwiftUI bridging protocol called UIViewRepresentable
. The UIViewRepresentable
protocol will let us bridge the two frameworks, UIKit and SwiftUI.
Accompanying this, we will include two labels – Breathe In and Breathe Out – so that you can breathe along with the flowers, similar to a meditation app.
So, in this chapter, we will cover the following topics:
- Adding the variables and a winter background
- Animating the text labels
- Using the
blur
modifier to create a vapor effect...