import SwiftUI
struct ExplicitAnimationContentView: View {
@State private var animationAmount = 0.0
var body: some View {
Button("点我") {
withAnimation(.interpolatingSpring(stiffness: 3, damping: 5)) {
self.animationAmount += 360
}
}
.padding(50)
.background(Color.red)
.foregroundColor(.white)
.clipShape(Circle())
.rotation3DEffect(.degrees(animationAmount), axis: (x: 0, y: 1, z: 0))
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ExplicitAnimationContentView()
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)