How to animate background?
I use an image view with an image a开发者_JS百科nd on view load I started a timer that scroll image.
It's all ok, i decrement x and the image seems to be animated.But, when the image end (in my case 800px) i reset x to 0 and i see an ugly animation...
Is there a better way to fix this simple animation?
[...]
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(scrollBackground) userInfo:nil repeats:YES];
[,,,]
int x = 0;
- (void) scrollBackground {
if (x <= -480 ) x = 0;
[background setFrame:CGRectMake(x--, background.frame.origin.y, background.frame.size.width, background.frame.size.height)];
}
thanks
what does "ugly animation" mean? if the image ends in similar way as it begins it is probably ok, at -480 the image should be the same as at x=0 suppose to have a cilinder with a texture around it, in the point of conjunction you see the difference only if the image ends different from the begin of the same image.
精彩评论