问题:
ios 如何实现path 动画
解决:
1 2 3 4 5 6 7 8 9 10 11 |
let l = CAShapeLayer() l.path = ps[0].cgPath self.layer.addSublayer(l) let anim = CABasicAnimation(keyPath: "path") anim!.fromValue = ps[0].cgPath anim!.toValue = ps[1].cgPath anim!.duration = mduration anim!.fillMode = kCAFillModeForwards; anim!.isRemovedOnCompletion = false; anim!.repeatCount = FLT_MAX; l.add(anim!, forKey: animName) |