2017年3月7日 | Leave a comment 问题: ios 如何实现path 动画 解决: 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) 1234567891011 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)