Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class ActorAnimator
- Object
- ActorAnimator
Chooses an Actor’s animation frame from its MovementState: the
presentation half of Corgi Engine’s animator parameters.
Each state maps to a Clip of frame indices in a sprite sheet. A state with
no clip of its own borrows a related one – running falls back to walking,
crawling to crouching, every airborne state to jumping or falling, and in the
end everything to idle – so a character drawn with only idle, walk and jump
frames still animates sensibly. One animator can serve every actor of a kind;
the per-actor progress lives in a Track.
Nested types
class ActorAnimator.Clip | A run of frames. |
class ActorAnimator.Track | One actor’s place in its animation. |
Constructors
public ActorAnimator() |
Methods
Inherited methods
Constructor details
ActorAnimator
public ActorAnimator()Method details
set
public ActorAnimator set(MovementState state, ActorAnimator.Clip clip)Sets a state’s clip.
Parameters
stateMovementState- the state
clipActorAnimator.Clip- its clip, or null to borrow a related one
Returns
this animator
set
public ActorAnimator set(MovementState state, int ticksPerFrame, boolean loop, int... frames)Sets a state’s clip from frames.
Parameters
stateMovementState- the state
ticksPerFrameint- ticks each frame shows
loopboolean- whether it repeats
framesint...- the sheet frame indices
Returns
this animator
clipFor
public ActorAnimator.Clip clipFor(MovementState state)The clip a state shows, borrowed if it has none.
Parameters
stateMovementState- the state
Returns
the clip, or null if not even idle has one
frameFor
public int frameFor(ActorAnimator.Track track)The frame for a track.
Parameters
trackActorAnimator.Track- the actor’s track
Returns
the sheet frame index, 0 if nothing is set