How can I know the values in CABasicAnimation keyPath

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

I find some code like this:

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


        
2条回答
  •  Happy的楠姐
    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.

提交回复
热议问题