org.jrabbit.base.graphics.skins.animation
Class AnimationFactory

java.lang.Object
  extended by org.jrabbit.base.graphics.skins.animation.AnimationFactory

public class AnimationFactory
extends java.lang.Object

AnimationFactory is a static convenience class for creating AnimatedSkins. The methods here only help with creating AnimatedSkins that use whole images (by using ImageSkins); to make animations with more complex Skins the developer needs to do the work themselves.

Author:
Chris Molini

Constructor Summary
AnimationFactory()
           
 
Method Summary
static AnimatedSkin createAnimation(int[][] index, int speed, java.lang.String... references)
          Creates an AnimatedSkin that uses the indicated references and has the indicated animation cycles.
static AnimatedSkin createAnimation(int[][] index, java.lang.String... references)
          Creates an AnimatedSkin that uses the indicated references and has the indicated animation cycles.
static AnimatedSkin createLoop(int speed, java.lang.String... references)
          Returns a looping animation that cycles through the indicated Images continuously at the indicated speed.
static AnimatedSkin createLoop(java.lang.String... references)
          Returns a looping animation that cycles through the indicated Images continuously at the default speed.
static AnimatedSkin createStill(java.lang.String reference)
          Creates an AnimatedSkin that is "not" animated, in that it is simply a single image shown for every frame.
private static ImageSkin[] makeFrames(java.lang.String... references)
          Creates a list of ImageSkins that display the Images with the indicated references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationFactory

public AnimationFactory()
Method Detail

createStill

public static AnimatedSkin createStill(java.lang.String reference)
Creates an AnimatedSkin that is "not" animated, in that it is simply a single image shown for every frame. Obviously, this somewhat defeats the purpose of using Animations, but it is sometimes useful (e.g., skinning an object extending a class that only uses AnimatedSkins, but doesn't need to be expressly animated).

Parameters:
reference - The reference of the Image to show.
Returns:
An AnimatedSkin that displays the indicated image.

createLoop

public static AnimatedSkin createLoop(java.lang.String... references)
Returns a looping animation that cycles through the indicated Images continuously at the default speed.

Parameters:
references - The references of the Images to show.
Returns:
An AnimatedSkin that loops through the indicated Images.

createLoop

public static AnimatedSkin createLoop(int speed,
                                      java.lang.String... references)
Returns a looping animation that cycles through the indicated Images continuously at the indicated speed.

Parameters:
speed - The base duration of each frame of animation.
references - The references of the Images to show.
Returns:
An AnimatedSkin that loops through the indicated Images.

createAnimation

public static AnimatedSkin createAnimation(int[][] index,
                                           java.lang.String... references)
Creates an AnimatedSkin that uses the indicated references and has the indicated animation cycles. It is animated at the default speed.

Parameters:
index - The list of animation cycles to use.
references - The list of Image references.
Returns:
An AnimatedSkin that uses the indicated Images and animations.

createAnimation

public static AnimatedSkin createAnimation(int[][] index,
                                           int speed,
                                           java.lang.String... references)
Creates an AnimatedSkin that uses the indicated references and has the indicated animation cycles. It is animated at the indicated speed.

Parameters:
index - The list of animation cycles to use.
speed - The base duration of each frame of animation.
references - The list of Image references.
Returns:
An AnimatedSkin that uses the indicated Images and animations.

makeFrames

private static ImageSkin[] makeFrames(java.lang.String... references)
Creates a list of ImageSkins that display the Images with the indicated references.

Parameters:
references - The references of the Images to show.
Returns:
An array of ImageSkins created from the list of references.