【发布时间】:2013-10-24 00:33:03
【问题描述】:
我想为我的多个 UIImageView 设置动画,使其从 A 点线性移动到 B 点。
我正在使用 options:UIViewAnimationOptionCurveLinear - Apple 文档说:“线性动画曲线会导致动画在其持续时间内均匀发生。”。
这是我正在使用的代码:
[UIView animateWithDuration:1.5
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
//start animation of random grasses with const speed and const y
for (int i=0;i<45;i++){
if ([self.view viewWithTag:i+100]){
CGRect frameOfGrass = [self.view viewWithTag:i+100].frame;
frameOfGrass.origin.y = -100;
[self.view viewWithTag:i+100].frame = frameOfGrass;
}}
}
completion:^(BOOL finished){
//
}];
注意: 每个 imageView 的 Y 位置是 600-700 的随机数。
但结果看起来更像 UIViewAnimationOptionCurveEaseOut - “缓出曲线导致动画开始快速,然后在完成时变慢。”因为所有图像在 and 处都会变慢。
这是应用运行的截图:
知道为什么会这样吗?
【问题讨论】:
标签: ios iphone objective-c animation uiview