我正在尝试沿着bezier路径的一部分动画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")
Run Code Online (Sandbox Code Playgroud)
但是,这只会将视图移动到所需的点,并且不会为其设置动画.如何在Bezier路径的一部分上为视图设置动画?
谢谢