我想为我的多个 UIImageView 设置动画,使其从 A 点线性移动到 B 点。
我正在使用选项: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 处变慢。
这是应用程序运行的屏幕截图:
 
 
 

知道为什么会这样吗?