import SwiftUI
struct ContentView: View {
@State var animationAmount:CGFloat = 1
var body: some View {
print("animationAmount:\(animationAmount)")
return VStack{
Stepper("Scale amount", value:$animationAmount.animation(.easeOut(duration: 1).repeatCount(3, autoreverses: true)), in: 1...10)
Spacer()
Button("Tap Me") {
self.animationAmount += 1
}.padding(40).background(Color.red).foregroundColor(.white).clipShape(Circle())
.scaleEffect(animationAmount)
}
}
}
SwiftUI:Animation & Stepper
最新推荐文章于 2024-05-17 10:10:46 发布