public class Animation extends Object implements Nameable
It contains the first
and last
animation frame number, the animation speed
, a
reverse
flag (for reversed animation), and a repeat
flag (for looped animation).
first
: first frame of the animation that will be played (included).last
: last frame of the animation that will be played (included).speed
: animation speed.reverse
: reverse flag (1 -> 2 -> 3 -> 2 -> 1).repeat
: repeat flag (1 -> 2 -> 3 -> 1 -> 2 -> 3...).
Note: reverse
and repeat
can also be combined to play in loop an animation in reverse:
1 -> 2 -> 3 -> 2 -> 1 -> 2 -> 3....
Example:
final Animation animation = new Animation(4, 6, 0.125, false, true); print(animation.getFirst()); // 4 print(animation.getLast()); // 6 print(animation.getSpeed()); // 0.125 print(animation.getReverse()); // false print(animation.getRepeat()); // true
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NAME
Animation default name.
|
static int |
MINIMUM_FRAME
The minimum frame number.
|
Constructor and Description |
---|
Animation(String name,
int firstFrame,
int lastFrame,
double speed,
boolean reverse,
boolean repeat)
Create an animation, which can be played by an
Animator . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
int |
getFirst()
Get the first frame of the animation.
|
int |
getLast()
Get the last frame if the animation.
|
String |
getName()
Get the name.
|
boolean |
getRepeat()
Get the repeat state.
|
boolean |
getReverse()
Get the reverse state.
|
double |
getSpeed()
Get the animation speed.
|
int |
hashCode() |
public static final String DEFAULT_NAME
public static final int MINIMUM_FRAME
public Animation(String name, int firstFrame, int lastFrame, double speed, boolean reverse, boolean repeat)
Animator
.name
- The animation name.firstFrame
- The first frame (included) index to play (superior or equal to MINIMUM_FRAME
).lastFrame
- The last frame (included) index to play (superior or equal to firstFrame).speed
- The animation playing speed (superior or equal to 0.0).reverse
- true
to reverse animation play (play it from first to last, and last to first).repeat
- The repeat state (true
will play in loop, false
will play once only).LionEngineException
- If invalid animation.public int getFirst()
public int getLast()
public double getSpeed()
public boolean getReverse()
public boolean getRepeat()
Copyright © 2017 Byron 3D Games Studio. All rights reserved.