点击的动画效果
程序员文章站
2022-05-02 20:06:34
...
func scaleAnimation() {
let scaleAnim1 = CABasicAnimation(keyPath: "transform")
scaleAnim1.fromValue = NSValue(CATransform3D: CATransform3DIdentity)
scaleAnim1.toValue = NSValue(CATransform3D: CATransform3DMakeScale(0.97, 0.97, 1.0))
scaleAnim1.fillMode = kCAFillModeForwards
scaleAnim1.duration = 0.2
scaleAnim1.beginTime = 0
scaleAnim1.removedOnCompletion = true
let scaleAnim2 = CABasicAnimation(keyPath: "transform")
scaleAnim2.toValue = NSValue(CATransform3D: CATransform3DIdentity)
scaleAnim2.fillMode = kCAFillModeForwards
scaleAnim2.duration = 0.1
scaleAnim2.beginTime = 0.2
scaleAnim2.removedOnCompletion = true
let animGroup = CAAnimationGroup()
animGroup.animations = [scaleAnim1,scaleAnim2]
animGroup.duration = 0.3
animGroup.removedOnCompletion = true
animGroup.delegate = self
self.layer.addAnimation(animGroup, forKey: "scaleAnimation")
}
上一篇: WPF 动画闪烁效果
下一篇: jquery的动画效果