开发者

UIView rotate animation on a point

How do I rotate animate a UIView but with respect of a point?

It's kinda like how the moon is rotating the earth kinda movement. It rotates around the earth as opposed to just the开发者_如何转开发 moon itself rotating.

Thanks,

Tee


I think what you'll need to do here is use a CAKeyframeAnimation to move your view along a path. In this case, of course, you'll use a circular path. However, you also want to rotate the view. A CABasicAnimation should work for that. You can run both animations simultaneously using CAAnimationGroup.

Warning: I haven't tried this, so if you encounter trouble that makes you think this is the wrong path, trust that.

It seems like you might also be able to do the whole animation using a single keyframe animation on the view's transform property. That may or may not be the case, but calculating an array of intermediate transformation matrices doesn't seem like a lot of fun.

Let us know how it works out.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜