【发布时间】:2018-06-23 11:24:26
【问题描述】:
我正在尝试沿贝塞尔路径的一部分为 UIView 设置动画。我找到了一种使用以下代码将视图移动到路径的任何部分的方法:
let animation = CAKeyframeAnimation(keyPath: "position")
animation.path = trackPath.cgPath
animation.rotationMode = kCAAnimationRotateAuto
animation.speed = 0
animation.timeOffset = offset
animation.duration = 1
animation.calculationMode = kCAAnimationPaced
square.layer.add(animation, forKey: "animate position along path")
但是,这只是将视图移动到所需的点而不是动画。您如何在贝塞尔路径的一部分上为视图设置动画?
谢谢
【问题讨论】:
-
检查这个答案也许可以帮助你,让我知道stackoverflow.com/questions/39275901/…
-
感谢您的帮助,但这篇文章更符合我遇到的问题:stackoverflow.com/questions/34286904/…
标签: ios swift animation uiview core-animation