CAShapeLayer动画lineCap属性

问题描述 投票:0回答:2

我想动画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中,但是找不到合适的值

ios swift core-animation
2个回答
2
投票

2
投票

看看文档:

https://developer.apple.com/documentation/quartzcore/cashapelayer/1521905-linecap

搜索“animatable”这个词。你找不到它(至少,不是这个属性)。所以你期望你可以为这个属性设置动画是错误的。

© www.soinside.com 2019 - 2024. All rights reserved.