我想动画CAShapeLayer的lineCap属性。这是我的代码:
func animate() {
let animation = CABasicAnimation(keyPath: "lineCap")
animation.toValue = CAShapeLayerLineCap.round
animation.duration = 0.3
//var progressLayer: CAShapeLayer?
progressLayer?.add(animation, forKey: "AnimationKey")
}
什么都没发生。可能错误在keyPath中,但是找不到合适的值
看看文档:
https://developer.apple.com/documentation/quartzcore/cashapelayer/1521905-linecap
搜索“animatable”这个词。你找不到它(至少,不是这个属性)。所以你期望你可以为这个属性设置动画是错误的。