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

elp
  • 8,021
  • 7
  • 61
  • 120
  • solved using: CABasicAnimation animationWithKeyPath:@"transform.translation.x"] – elp Jan 29 '11 at 20:53

1 Answers1

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.

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