public class NetworkFlickAnimationElement extends AnimationElement
Constructor and Description |
---|
NetworkFlickAnimationElement(IItem item,
IStage stage)
Creates an animation element for the supplied item which can then create
the flick motion by repositioning the managed item using JME's animation
system.
|
Modifier and Type | Method and Description |
---|---|
void |
bounce(float vX,
float vY,
float tpf,
BehaviourUtilities.RelativePosition bouncePosition)
Bounce.
|
void |
elementStart(float tpf)
Called on the first
|
float |
getDeceleration()
Gets the deceleration at which the managed item's momentum is reduced.
|
float |
getMaxDimension()
Uses the managed item's bounding box to find the largest of its width or
height.
|
boolean |
isFinished()
When this method returns true, the animation element will be reset.
|
void |
moveWithVelocity(com.jme3.math.Vector2f velocity)
This method effectively initiates the flick of the managed item.
|
void |
reset()
Called when the animation element is finished.
|
void |
setDeceleration(float deceleration)
Sets the deceleration at which the managed item's momentum is reduced.
|
void |
setMaxDimension(float maxDim)
Sets the predetermined max dimension of the managed item.
|
void |
updateAnimationState(float tpf)
Called each frame in the game loop.
|
enable, toString, updateState
public NetworkFlickAnimationElement(IItem item, IStage stage)
item
- The item to be influenced by this animation.stage
- The stage the item currently resides in.public void bounce(float vX, float vY, float tpf, BehaviourUtilities.RelativePosition bouncePosition)
vX
- the v xvY
- the v ytpf
- the tpfbouncePosition
- the bounce positionpublic void elementStart(float tpf)
AnimationElement
elementStart
in class AnimationElement
public float getDeceleration()
public float getMaxDimension()
public boolean isFinished()
AnimationElement
isFinished
in class AnimationElement
public void moveWithVelocity(com.jme3.math.Vector2f velocity)
velocity
- The direction and momentum with which the managed item is
to be flicked.public void reset()
AnimationElement
isFinished()
reset
in class AnimationElement
public void setDeceleration(float deceleration)
drag
- The deceleration at which the managed item's momentum is
reduced.public void setMaxDimension(float maxDim)
maxDim
- The predetermined max dimension of the managed itempublic void updateAnimationState(float tpf)
AnimationElement
updateAnimationState
in class AnimationElement