png sequence animation on iphone ?

Discussion in 'iPhone/iPad Programming' started by imaumac, Oct 28, 2008.

  1. macrumors member

    Joined:
    Oct 15, 2008
    #1
    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 !
     
  2. macrumors regular

    Joined:
    Mar 24, 2008
    #2
    Check out the documentation of UIImageView. It has a whole group of method for animating images.
     
  3. thread starter macrumors member

    Joined:
    Oct 15, 2008
    #3
    thanks i will try and looking for. thanks
     
  4. thread starter macrumors member

    Joined:
    Oct 15, 2008
    #4
    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
     
  5. macrumors regular

    Joined:
    Mar 24, 2008
    #5
    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.

    Code:
    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.
     
  6. macrumors newbie

    Joined:
    Oct 4, 2009
    #6
    what about no looping?

    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.
     
  7. Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #7
    Code:
    
    [COLOR="Green"]//your animation method[/COLOR]
    - (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];
    	}
    
    [COLOR="green"]//your did stop selector[/COLOR]
    - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
    	{
    	if (([animationID isEqualToString:@"flashFadeIn"]) && finished)
    		[self flashFadeOut];
    		[COLOR="green"]//or do whatever else you want when the flashFadeIn animation finishes[/COLOR]
    	}
    
     

Share This Page