How can I know the values in CABasicAnimation keyPath

前端 未结 2 573
情歌与酒
情歌与酒 2021-02-05 07:17

I find some code like this:

CABasicAnimation *anim = [CABasicAnimation animation];
anim.keyPath = @\"transform.scale\";
anim.fromValue = [NSNumber numberWithFloa         


        
相关标签:
2条回答
  • 2021-02-05 07:34

    Core Animation extends KVC to support direct addressing of fields (or pseudo fields) of some struct-type properties of layers. The feature is described in Core Animation Extensions To Key-Value Coding.

    0 讨论(0)
  • 2021-02-05 07:41

    I'm not sure, but I found a solution that could probably help.

    IN SWIFT: Instead of writing a String you can use this:

    let shadowAnimation = CABasicAnimation(keyPath: #keyPath(CALayer.shadowRadius))
    

    When you type CALayer. <- autocomplete should give you the available keyPaths.

    I hope this helps.

    0 讨论(0)
提交回复
热议问题