0


i try to animate background in my app.

I use an image view with an image and 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

1
  • solved using: CABasicAnimation animationWithKeyPath:@"transform.translation.x"]
    – elp
    Jan 29, 2011 at 20:53

1 Answer 1

0

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.

1
  • bad in the sense that when it arrives it will go, back to 0 and this effect is not good ...
    – elp
    Jan 29, 2011 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.