import SwiftUI
struct ContentView: View {
@State var animationAmount = 0.0
var body: some View {
Button("Tap Me") {
withAnimation(.interpolatingSpring(stiffness: 5, damping: 1)) {
self.animationAmount += 360
}
}.padding(50).background(Color.red).foregroundColor(.white).clipShape(Circle())
.rotation3DEffect(.degrees(animationAmount), axis: (x: 1, y: 0, z: 0))
}
}
SwiftUI:withAnimation & rotation3DEffect
最新推荐文章于 2024-05-17 10:10:46 发布