Interface IAnimation
AnimationManager.
An animation is modeled as a function that takes a value between 0 and 1 as input.
- 0: the start of the animation
- 1: the end of the animation
AnimationManager generates this value using a duration that is assigned to the animation and the elapsed time at the moment the animation is updated.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the duration of this animation in milliseconds.booleanReturns whether this animation is a looping animation.voidonStart()This method is called when the animation is started.voidonStop()This method is called when the animation is stopped.booleanonUpdate(double fraction) This method is called to update the animation.
-
Method Details
-
onStart
void onStart()This method is called when the animation is started.No onUpdate call will be performed before this method is called. This method is not supposed to call
IAnimation#onUpdateitself. -
onUpdate
This method is called to update the animation.This method will typically perform an action, e.g. update the camera location.
- Parameters:
fraction- The position where you are located in the animation. This position varies from 0 to 1 (0 and 1 are included).- Returns:
- if the action needs to continue. Returning false stops the animation and triggers a call to the
onStopmethod. - Throws:
IllegalArgumentException- when the fraction value is invalid.
-
onStop
void onStop()This method is called when the animation is stopped.No
IAnimation#onUpdatecall will be performed after this method is called. This method is not supposed to callIAnimation#onUpdateitself.Note that this method may be called before the animation has finished. This can for example happen when an animation is canceled.
-
getDuration
Returns the duration of this animation in milliseconds.This information is used by
AnimationManager. In practice, this means that theIAnimation#onUpdatemethod is called with a value of1.0after this duration has elapsed.- Returns:
- the duration of this animation in milliseconds.
-
isLooping
boolean isLooping()Returns whether this animation is a looping animation.This information is used by
AnimationManager. If false, the animation is automatically stopped and removed once the duration has elapsed. Otherwise, the animation will continue as long asIAnimation#onUpdatereturns true. In case of a looping animation, the fraction that is passed to theIAnimation#onUpdaterestarts at 0 once the animation has completed and progresses again towards 1.- Returns:
- if this animation is a looping animation.
-