PDA

View Full Version : png sequence animation on iphone ?




imaumac
Oct 28, 2008, 08:35 PM
some body toldme to animate some png sequence:
we can use a timer.

but i dont know how to do it.
some one help please.

or another suggestion to animate 7 small png sequence please ?

thank a lot !



SqueegyX
Oct 28, 2008, 09:15 PM
Check out the documentation of UIImageView. It has a whole group of method for animating images.

imaumac
Oct 29, 2008, 07:18 AM
thanks i will try and looking for. thanks

imaumac
Oct 29, 2008, 07:57 AM
Really thanks, i was looking on documentation how do this.
and lookinf for UIImageView animation.
but I dont understand a lot.

is there a code to copy and paste please.
I am ashamed to ask, ...realy

please one more time sorry
but i realy need this.

is there most way to learn this on internet website?
or What is the easier code to learn please ?

its only 4 small png sequence (loop)

and I need to animate while you are reading a text please.
thanks a lot.
any help are realy welcome.

i found this URL but i dont know what is the best to learn:
https://developer.apple.com/iphone/l...ion/index.html

SqueegyX
Oct 29, 2008, 10:38 AM
Lets see. The docs seem pretty clear. I have never done this before but it looks like this is how it works:

Make a UIImageView in interface builder and link it to an IBOutlet in your view controller.


imageArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"frame1.png"],
[UIImage imageNamed:@"frame2.png"],
[UIImage imageNamed:@"frame3.png"],
[UIImage imageNamed:@"frame4.png"],
nil];

myImageView.animationImages = imageArray;
myImageView.animationDuration = 0.25 // Seconds
myImageView.animationRepeatCount = 0 // zero loops for ever
[myImageView startAnimating];


Duration and repeat count are not required and have good default values, but that is how you set them.

HughesLin
Oct 4, 2009, 09:24 PM
Lets see. The docs seem pretty clear. I have never done this before but it looks like this is how it works:

Make a UIImageView in interface builder and link it to an IBOutlet in your view controller.


imageArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"frame1.png"],
[UIImage imageNamed:@"frame2.png"],
[UIImage imageNamed:@"frame3.png"],
[UIImage imageNamed:@"frame4.png"],
nil];

myImageView.animationImages = imageArray;
myImageView.animationDuration = 0.25 // Seconds
myImageView.animationRepeatCount = 0 // zero loops for ever
[myImageView startAnimating];


Duration and repeat count are not required and have good default values, but that is how you set them.

What about : if I just want the animation runs 1 time then stops (no looping), and the last frame (frame4.png) remains on the screen. How should I do this? Thanks in advance.

Darkroom
Oct 4, 2009, 11:10 PM
//your animation method
- (void)flashFadeIn
{
[UIView beginAnimations:@"flashFadeIn" context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationBeginsFromCurrentState:currentStateBOOL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationRepeatCount:repeatCount];
[UIView setAnimationDuration:kAnimationFlashFadeInDuration];

[self.flash setAlpha:1.0];

[UIView commitAnimations];
}

//your did stop selector
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
if (([animationID isEqualToString:@"flashFadeIn"]) && finished)
[self flashFadeOut];
//or do whatever else you want when the flashFadeIn animation finishes
}