Class GifImage

java.lang.Object
  extended by GifImage

public class GifImage
extends java.lang.Object

This class can be used to read animated gif image files and extract the individual images of the animation sequence.

To use GifImage in an actor, declare it as an instance variable:

 GifImage gifImage = new GifImage("mygif.gif");
 
 
Then, in the act() method of your actor, set the actor's image to the current image from your GifImage instance:
 setImage(gifImage.getCurrentImage());
 
 


Constructor Summary
GifImage(java.lang.String file)
          Construct a new GifImage instance using the specified image file.
 
Method Summary
 greenfoot.GreenfootImage getCurrentImage()
          Get the current image in the animation sequence.
 java.util.List<greenfoot.GreenfootImage> getImages()
          Get all the images used in the animation
 boolean isRunning()
          Determines whether the animation is running
 void pause()
          Pause the animation.
 void resume()
          Resume the animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GifImage

public GifImage(java.lang.String file)
Construct a new GifImage instance using the specified image file. The animation will initially be running. Use getImage() at any time to get the current image in the animation sequence.

Method Detail

getImages

public java.util.List<greenfoot.GreenfootImage> getImages()
Get all the images used in the animation

Returns:
a list of GreenfootImages, corresponding to each frame.

pause

public void pause()
Pause the animation.


resume

public void resume()
Resume the animation.


isRunning

public boolean isRunning()
Determines whether the animation is running

Returns:
true if the animation is running, false otherwise

getCurrentImage

public greenfoot.GreenfootImage getCurrentImage()
Get the current image in the animation sequence. This will change over time.

Returns:
The current image