开发者

iPhone: Synchronize animations on two different layers

开发者 https://www.devze.com 2023-01-29 21:48 出处:网络
I need to synchronize a path animation on two different layers (one is used as a mask for another layer, the other shows a graphical element that follows the path, i.e. draws the mask). If I just set

I need to synchronize a path animation on two different layers (one is used as a mask for another layer, the other shows a graphical element that follows the path, i.e. draws the mask). If I just set them up identically, they never quite do the same thing. Currently, I am using a CAKeyframeAnimation with a path (for the graphical element) and a CABasicAnimation, where I animate "strokeEnd" of the same path from 0.0 to 1.0 (for the mask).

I guess an animation group does not work here, since that would mean I apply the group to the mask 开发者_运维技巧layer, which would hide the graphical element.


Have you set calculationMode = kCAAnimationPaced for the keyframe animation?


Apple has informed me of a known bug in iOS7 where certain paths (such as elliptical paths) will not work well with respect to animating 2 different layers along the same path, e.g. strokeEnd of one layer, and position of another layer. Specifically, the 2 animations fall in and out of sync during the animation, and look sloppy. Apple also informed me there is no known workaround. I also filed a bug with Apple.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号