开发者

Delay between UIImageView animation cycles?

I have a simple animation that repeats, but between the repeats (after each 5 frames cycle) there is a small lag of about 200 ms, and the transition is not smooth. Why?

- (void)Animation
{
    imageView.animationImages = [NSArray arrayWithObjects:
开发者_Go百科                                    [UIImage imageNamed:@"walkcycle-01.png"],
                                    [UIImage imageNamed:@"walkcycle-02.png"],
                                    [UIImage imageNamed:@"walkcycle-03.png"],
                                    [UIImage imageNamed:@"walkcycle-04.png"],
                                    [UIImage imageNamed:@"walkcycle-05.png"], nil];
    imageView.animationDuration = 1.4;
    [imageView setAnimationRepeatCount: 0];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    [imageView startAnimating];
}


I'm assuming that, because you have the repeat count set to 0, you're simply calling Animation multiple times.

If so, it may be that creating the animation is CPU intensive, therefore causing it to take a few seconds in between to build the animation. I'd recommend using a repeat instead of making it over and over.


Did you try to set the AnimationRepeatCount to INFINITY? Also you can try -1

[UIView setAnimationRepeatCount: INFINITY];

or

[UIView setAnimationRepeatCount: -1];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜