iPhone如何通过自定义路径翻译图层?
我制作了包含图像的 CAlayer。我基本上想做的是将此图像转换到新位置,但不是使用简单的直接路径,而是我想使用圆形路径将图像移动到该位置。
我无法在图层中使用旋转动画,因为图像会向一侧移动一点,而这不是我想要的。例如,如果我旋转 180 度,图像将位于我想要的位置,但底部和顶部将颠倒,图像将上下颠倒。
有什么方法可以通过自定义路径翻译图像吗?
PS如果我的问题听起来有点令人困惑,我会尽力更准确。
I have made CAlayer that contains an image. What i basically want to do is to translate this image to new location, but not by using simple straight forward path, but i want to move image to that location by using circular path.
I cant use rotation animation in layer, because image will be shifted a little bit side ways, and thats not i want. For example if i make rotation by 180 deg, image will be at location that i want, but bottom and top will be reversed, image will be upside down.
Is there any way i can translate image via custom path?
P.S If my question sound a little confusing, i'll try to be more precise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
CAKeyframeAnimation
类。有一个path
属性,您可以在其中设置 CGPathRef 来进行翻译。Try the
CAKeyframeAnimation
class. There's apath
property, where you can set a CGPathRef to do the translation.