public class ActionFactory
extends java.lang.Object
Action
objects.Constructor and Description |
---|
ActionFactory() |
Modifier and Type | Method and Description |
---|---|
static Action |
boundToScreen(double screenWidth,
double screenHeight)
Create an Action that automatically calls
Sprite.boundToScreen(double, double) . |
static Action |
delay(double duration)
Create an Action that waits for a specified amount of time.
|
static Action |
destroyOutsideScreen(double screenWidth,
double screenHeight)
Create an Action that removes a Sprite if no portion of the Sprite remains
within the screen boundaries.
|
static Action |
fadeIn(double fadeRate)
Create an Action to fade in (increase opacity of) a Sprite over a period of time.
|
static Action |
fadeOut(double fadeRate)
Create an Action to fade out (reduce opacity of) a Sprite over a period of time.
|
static Action |
forever(Action action)
Create an Action that repeats another Action forever.
|
static Action |
moveBy(double deltaX,
double deltaY,
double duration)
Create an Action to move a Sprite by a fixed amount over a period of time.
|
static Action |
remove()
Create an Action that automatically removes a Sprite.
|
static Action |
repeat(Action action,
int totalTimes)
Create an Action that repeats another Action a fixed number of times.
|
static Action |
rotateBy(double deltaAngle,
double duration)
Create an Action to rotate a Sprite by a fixed amount over a period of time.
|
static Action |
sequence(Action... actions)
Create an Action to perform a sequence of actions.
|
static Action |
wrapToScreen(double screenWidth,
double screenHeight)
Create an Action that automatically calls
Sprite.wrapToScreen(double, double) . |
public static Action moveBy(double deltaX, double deltaY, double duration)
deltaX
- distance to move Sprite in the x-directiondeltaY
- distance to move Sprite in the y-directionduration
- total time to be used for movementpublic static Action rotateBy(double deltaAngle, double duration)
deltaAngle
- angle to rotate Spriteduration
- total time to be used for movementpublic static Action fadeOut(double fadeRate)
ActionFactory.sequence( ActionFactory.fadeOut(fadeRate), ActionFactory,remove() )
fadeRate
- amount to reduce opacity by per secondpublic static Action fadeIn(double fadeRate)
fadeRate
- amount to increase opacity by per secondpublic static Action sequence(Action... actions)
actions
- one or more actions to perform in sequencepublic static Action repeat(Action action, int totalTimes)
action
- Action to be repeatedtotalTimes
- total number of times to repeat the specified Actionpublic static Action forever(Action action)
action
- Action to be repeatedpublic static Action delay(double duration)
sequence(Action...)
.
duration
- amount of time to waitpublic static Action remove()
public static Action boundToScreen(double screenWidth, double screenHeight)
Sprite.boundToScreen(double, double)
.
screenWidth
- width of screenscreenHeight
- height of screenSprite.boundToScreen(double, double)
.public static Action wrapToScreen(double screenWidth, double screenHeight)
Sprite.wrapToScreen(double, double)
.
screenWidth
- width of screenscreenHeight
- height of screenSprite.wrapToScreen(double, double)
.public static Action destroyOutsideScreen(double screenWidth, double screenHeight)
screenWidth
- width of screenscreenHeight
- height of screen