【发布时间】:2012-03-18 18:35:08
【问题描述】:
我已经设法使用 [UIView animateWithDuration... 来完成我在 UI 中需要的动画。现在我想沿着弯曲的路径移动图像,整个 CAAnimation 集群对我来说看起来非常令人生畏。
如果有人能帮我填写我希望我能编码的方法,我将非常感激,它看起来像这样:
- (void)makeAnImageFlyFrom:(UIImageView *)imageViewA to:(UIImageView *)imageViewB alongPath:(CGMutablePathRef)path duration:(NSTimeInterval)duration {
UIImage *imageToFly = imageViewA.image;
// magic, that i'm too lazy to learn right now goes here
// image flys along the path and gets scaled to match imageViewB.
// then view/layer hierarchy is just as it was, but imageViewB has a new image
// maybe this happens on animationDidStop...
imageViewB.image = imageToFly;
}
如果您认为这种方法有更智能的界面,请随意替换参数(如路径引用)。提前致谢。
【问题讨论】:
-
这几乎是构建 CAKeyframeAnimation 所需的信息,q.v。 developer.apple.com/library/mac/#documentation/GraphicsImaging/…
-
我认为我现在得到的半页破碎的东西会更难回答(并且由于我的错误而将答案发送到错误的方向)然后要求一个干净的石板。在我看来,这似乎是一个特定的操作,有更多经验的人会很容易掌握他们的技巧。 CAAnimation、CALayer、CAAnimationGroup、CATimingFunction、CGPath 等是移动图像的一个相当大的学习曲线。是否有一个明显的答案,任何 rube 都应该花点时间想出答案?把它放在一个侮辱我的答案中,我会把它标记为正确的。
标签: iphone uiviewanimation caanimation