EO Games and Apps
EO Games and Apps

Reputation: 3078

How to slow the speed using UIImage animation

Here is the code what I'm using to animate an image. Don't matter the value set in the animationduration value, the animation always is running faster. I have this code after the Super ViewDidLoad area:

item1.animationImages = [NSArray arrayWithObjects:
                            [UIImage imageNamed:@"1.png"],
                            [UIImage imageNamed:@"2.png"],
                            [UIImage imageNamed:@"3.png"],
                            [UIImage imageNamed:@"4.png"],
                            [UIImage imageNamed:@"5.png"],
                            [UIImage imageNamed:@"6.png"],
                            [UIImage imageNamed:@"7.png"],
                            [UIImage imageNamed:@"8.png"],nil];

[item1 setAnimationRepeatCount:1];

item1.animationDuration = 0.1;

[item1 startAnimating]; 

Upvotes: 0

Views: 1481

Answers (1)

EO Games and Apps
EO Games and Apps

Reputation: 3078

I think 0.1 is really short time to make this animation, try to set to 2.0. If the animation is a rotation, you can use this code:

[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
[self.image setTransform:CGAffineTransformRotate(self.image.transform, M_PI_4)];
}completion:^(BOOL finished){
//Comment
}];

You can change the animation on M_PI_4 /4 or /3 or -1 set the value what you want. Hope this code helps. Thanks

Upvotes: 1

Related Questions