Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS: animation for a .png

I want to animate a png in different versions; then I have three versions of this png... a darker version, a medium darker version and a clare version. In my animation I want to do this type of animation

dark -> medium dark -> clare -> medium dark -> dark -> medium dark ->.....

is it possible?

like image 303
cyclingIsBetter Avatar asked Dec 03 '22 06:12

cyclingIsBetter


1 Answers

sounds like you want to animate uiimageview

// create the view that will execute our animation
UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];

// load all the frames of our animation
campFireView.animationImages = [NSArray arrayWithObjects:    
                            [UIImage imageNamed:@"campFire01.gif"],
                            [UIImage imageNamed:@"campFire02.gif"],
                            [UIImage imageNamed:@"campFire03.gif"],
                            [UIImage imageNamed:@"campFire04.gif"],
                            [UIImage imageNamed:@"campFire05.gif"],
                            [UIImage imageNamed:@"campFire06.gif"],
                            [UIImage imageNamed:@"campFire07.gif"],
                            [UIImage imageNamed:@"campFire08.gif"],
                            [UIImage imageNamed:@"campFire09.gif"],
                            [UIImage imageNamed:@"campFire10.gif"],
                            [UIImage imageNamed:@"campFire11.gif"],
                            [UIImage imageNamed:@"campFire12.gif"],
                            [UIImage imageNamed:@"campFire13.gif"],
                            [UIImage imageNamed:@"campFire14.gif"],
                            [UIImage imageNamed:@"campFire15.gif"],
                            [UIImage imageNamed:@"campFire16.gif"],
                            [UIImage imageNamed:@"campFire17.gif"], nil];

// all frames will execute in 1.75 seconds
campFireView.animationDuration = 1.75;
// repeat the annimation forever
campFireView.animationRepeatCount = 0;
// start animating
[campFireView startAnimating];
// add the animation view to the main window 
[self.view addSubview:campFireView];

http://appsamuck.com/day2.html

like image 99
user513790 Avatar answered Jan 12 '23 14:01

user513790