Package games.pixscape.runtime.api
Interface AnimationFacade
public interface AnimationFacade
High-level sprite clip animation controls for one entity.
Operations affect an existing animated-sprite capability only. They do not create animation or render components on an arbitrary entity.
-
Method Summary
Modifier and TypeMethodDescriptionclip()Returns the selected clip name, or an empty string when animation is absent.booleanexists()Returns whether the entity has a complete animated-sprite capability.floatfps()intframe()Returns the resolved animation/atlas frame index held by Runtime, or-1when no frame has been resolved.booleanReturns whether the animation defines the supplied non-blank clip name.booleanReturns whether the selected non-looping clip has consumed its complete playback duration.booleanbooleanpause()play()Atomically selects an owned animation and starts one of its clips.Selects and starts an existing clip.Atomically selects an owned animation and starts one of its clips.restart()setAnimation(int assetId) Atomically selects an animation owned by this entity, restoring the definition's authored default clip and fps while preserving playback and loop state.setAnimation(String animationName) Atomically selects an animation owned by this entity, restoring the definition's authored default clip and fps while preserving playback and loop state.Selects an existing clip and resets its frame and playback time.setFps(float fps) Sets playback frames per second.setLoop(boolean loop) setStateTime(float stateTime) Sets playback time, clamping negative finite values to zero.floatReturns the existing animation playback time, or0when absent.stop()
-
Method Details
-
exists
boolean exists()Returns whether the entity has a complete animated-sprite capability. -
clip
String clip()Returns the selected clip name, or an empty string when animation is absent. -
hasClip
Returns whether the animation defines the supplied non-blank clip name. -
frame
int frame()Returns the resolved animation/atlas frame index held by Runtime, or-1when no frame has been resolved. -
stateTime
float stateTime()Returns the existing animation playback time, or0when absent. -
play
AnimationFacade play() -
pause
AnimationFacade pause() -
stop
AnimationFacade stop() -
restart
AnimationFacade restart() -
setAnimation
Atomically selects an animation owned by this entity, restoring the definition's authored default clip and fps while preserving playback and loop state.- Throws:
IllegalArgumentException- when the animation is unknown, unavailable, or not owned by this entity; the previous animation state remains unchanged
-
setAnimation
Atomically selects an animation owned by this entity, restoring the definition's authored default clip and fps while preserving playback and loop state.- Throws:
IllegalArgumentException- when the animation is unknown, unavailable, or not owned by this entity; the previous animation state remains unchanged
-
play
Selects and starts an existing clip.- Throws:
IllegalArgumentException- when the clip name is blank or unknown; the previous animation state remains unchanged
-
play
Atomically selects an owned animation and starts one of its clips.- Throws:
IllegalArgumentException- when the animation or clip is unknown, the animation is unavailable, or the animation is not owned by this entity; previous state remains unchanged
-
play
Atomically selects an owned animation and starts one of its clips.- Throws:
IllegalArgumentException- when the animation or clip is unknown, the animation is unavailable, or the animation is not owned by this entity; previous state remains unchanged
-
setClip
Selects an existing clip and resets its frame and playback time.- Throws:
IllegalArgumentException- when the clip name is blank or unknown; the previous animation state remains unchanged
-
setLoop
-
setFps
Sets playback frames per second. Zero is allowed as a non-advancing rate.- Throws:
IllegalArgumentException- whenfpsis negative, NaN, or infinite
-
setStateTime
Sets playback time, clamping negative finite values to zero.- Throws:
IllegalArgumentException- when the value is NaN or infinite
-
isPlaying
boolean isPlaying() -
isLooping
boolean isLooping() -
fps
float fps() -
isFinished
boolean isFinished()Returns whether the selected non-looping clip has consumed its complete playback duration. Looping clips and missing or invalid animation state never report finished.
-