iPhone:同步两个不同图层上的动画

发布于 2024-10-07 08:11:28 字数 229 浏览 0 评论 0原文

我需要同步两个不同图层上的路径动画(一个用作另一图层的蒙版,另一个显示遵循路径的图形元素,即绘制蒙版)。如果我只是将它们设置为相同,它们永远不会做完全相同的事情。目前,我使用带有路径(对于图形元素)的 CAKeyframeAnimation 和 CABasicAnimation,其中我将同一路径的“行程结束”从 0.0 动画到 1.0(对于蒙版)。

我想动画组在这里不起作用,因为这意味着我将组应用到遮罩层,这将隐藏图形元素。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半暖夏伤 2024-10-14 08:11:28

您是否为关键帧动画设置了calculationMode = kCAAnimationPaced?

Have you set calculationMode = kCAAnimationPaced for the keyframe animation?

变身佩奇 2024-10-14 08:11:28

Apple 通知我 iOS7 中的一个已知错误,其中某些路径(例如椭圆路径)对于沿同一路径对 2 个不同层进行动画处理(例如,一层的描边结束和另一层的位置)无法正常工作。具体来说,两个动画在动画播放过程中时而同步,时而不同步,看起来很草率。苹果还告诉我没有已知的解决方法。我还向 Apple 提交了一个错误。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文