Adding the background, a button, and animating the doors
Let’s continue and start to fill out ContentView
so that we can see the elevator, and then we can animate things.
First, we will add a black background to the whole scene. To do this, add a constant at the top just after the appData
variable to hold some color:
let backgroundColor = Color(UIColor.black)
Next, inside the body
property, let’s add ZStack
and call our backgroundColor
constant, setting the color for the screen:
var body: some View { ZStack { backgroundColor.edgesIgnoringSafeArea(.all) }
Now, we will need to call the ElevatorAndPeople
view so that we can make it visible in this file. Add the following code, still working inside ZStack
, and in fact, all subsequent code we add into...