Objective c iOS动画:背景持续移动(游戏)
我目前正在编写一个教育游戏,其中我需要背景不断移动。我尝试过使用块(iOS 4),由于某些原因,结果并不令人满意(即使我指定了线性动画,图像在最后也会变慢。有什么建议吗?谢谢你的帮助Objective c iOS动画:背景持续移动(游戏),objective-c,ios,animation,Objective C,Ios,Animation,我目前正在编写一个教育游戏,其中我需要背景不断移动。我尝试过使用块(iOS 4),由于某些原因,结果并不令人满意(即使我指定了线性动画,图像在最后也会变慢。有什么建议吗?谢谢你的帮助 soil0 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"soil900.jpg"]]; soil0.frame = CGRectMake(0, 0, [UIScreen mainScreen].applicationFrame.siz
soil0 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"soil900.jpg"]];
soil0.frame = CGRectMake(0, 0, [UIScreen mainScreen].applicationFrame.size.width, [UIScreen mainScreen].applicationFrame.size.height);
[UIView animateWithDuration:5.0
delay:0.0
options:UIViewAnimationOptionRepeat | UIViewAnimationCurveLinear
animations:^{
soil0.transform = CGAffineTransformMakeTranslation(0, -450); }
completion:^(BOOL fin) { if (fin)
{
soil0.transform = CGAffineTransformMakeTranslation(0, +450);
}
}];
我想您可能看到了一些缓解。
uiviewmanimationcurvelinear
用于setAnimationCurve
类方法。请尝试改用uiviewmanimationoptioncurvelinear