struct PageView: View {
@State private var showDetail = false
var body: some View {
Button(action: {
self.showDetail.toggle()
}, label: {
Image("1")
.scaleEffect(showDetail ? 5.5 : 1)
.animation(.easeInOut(duration: 13))
})
}
}
struct PageView_Preview: PreviewProvider {
static var previews: some View {
PageView()
}
}
动画效果定义
// Linear
.animation(.linear)
// Ease Animation
.animation(.easeInOut(duration: 0.3))
// Animation with Delay
.animation(Animation.easeOut(duration: 0.6).delay(0.1))
// Spring
.animation(.spring())
// Interpolating Spring
.animation(.interpolatingSpring(stiffness: 100, damping: 10))
.rotationEffect(Angle(degrees: 30))
.rotation3DEffect(Angle(degrees: 60), axis: (x: 0, y: 10, z: 0))
.scaleEffect(0.9)
.blendMode(.hardLight)
.blur(radius: 20)
网友评论