【发布时间】:2017-01-03 19:28:28
【问题描述】:
伙计们,我有以下代码来生成贝塞尔路径
firstLine.path = UIBezierPath(roundedRect: CGRect(x: frameSize.width / 2.2, y: frameSize.height / 2.6, width: 4, height: 4), cornerRadius: 10).cgPath
我尝试通过将 firstLine 移动到屏幕右侧 x 值并返回到原始位置来为 firstLine 设置动画。但我不知道动画中的 keyPath 用什么。
let animation = CABasicAnimation(keyPath: "??")
animation.toValue = // this should be the position to move?
animation.duration = 0.5 // duration of the animation
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) // animation curve is Ease Out
animation.fillMode = kCAFillModeBoth // keep to value after finishing
animation.isRemovedOnCompletion = false // don't remove after finishing
animation.autoreverses = true
animation.repeatCount = HUGE
有人可以帮我解决这个问题吗:)
【问题讨论】:
标签: swift swift3 core-animation uibezierpath