iOS animation: background continuously moving (game)
I am currently coding an educational game in which I need the background to be continuously moving. I've tried to use blocks (iOS 4), for some reason the result isn't satisfying (even if I specify a linear animation, the image slows down at the end. Any suggestion? Thanks for your help!
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 | UIViewAn开发者_如何学JAVAimationCurveLinear
animations:^{
soil0.transform = CGAffineTransformMakeTranslation(0, -450); }
completion:^(BOOL fin) { if (fin)
{
soil0.transform = CGAffineTransformMakeTranslation(0, +450);
}
}];
I think perhaps you are seeing easing. UIViewAnimationCurveLinear
is for use with the setAnimationCurve
class method. Try using UIViewAnimationOptionCurveLinear
instead.
精彩评论