I have been playing around with SwiftUI and its animation. Below is my code of a circle inside a navigationView with scaleEffect animation
@State private var isAnimating = false
NavigationView{
VStack{
ZStack{
Circle()
.fill(Color.blue)
.shadow(radius: 15)
.frame(width: 150, height: 150, alignment: .center)
.scaleEffect(isAnimating ? 1.2 : 1)
.onAppear() {
withAnimation(Animation.easeInOut(duration: 1.2).repeatForever()){
self.isAnimating = true
}
}
}
.padding(.top, 140)
Spacer()
}
.edgesIgnoringSafeArea(.all)
}
My preview shows the expected animation:
But somehow on the simulator, the animation is totally different:
Is this a bug from SwiftUI? What did I do wrong here?