public interface IAnimation
AnimationManager
.
An animation is modeled as a function that takes a value between 0 and 1 as input.
AnimationManager
generates this value using a duration that is assigned
to the animation and the elapsed time at the moment the animation is updated
.
Modifier and Type | Method and Description |
---|---|
Duration |
getDuration() |
boolean |
isLooping() |
void |
onStart()
This method is called when the animation is started.
|
void |
onStop()
This method is called when the animation is stopped.
|
boolean |
onUpdate(double fraction)
This method is called to update the animation.
|
void onStart()
No onUpdate call will be performed before this method is called. This method is not supposed to call IAnimation#onUpdate
itself.
boolean onUpdate(double fraction) throws IllegalArgumentException
This method will typically perform an action, e.g. update the camera location.
fraction
- The position where you are located in the animation. This position varies from 0 to 1 (0 and 1 are included).onStop
method.IllegalArgumentException
- when the fraction value is invalid.void onStop()
No IAnimation#onUpdate
call will be performed after this method is called. This method is not supposed to call IAnimation#onUpdate
itself.
Note that this method may be called before the animation has finished. This can for example happen when an animation is canceled.
@NotNull Duration getDuration()
AnimationManager
. In practice, this means that the IAnimation#onUpdate
method is called with a value of 1.0 after this duration has elapsed.boolean isLooping()
AnimationManager
. If false, the animation is automatically stopped and removed once the duration has elapsed. Otherwise, the animation will continue as long as IAnimation#onUpdate
returns true. In case of a looping animation, the fraction that is passed to the IAnimation#onUpdate
restarts at 0 once the animation has completed and progresses again towards 1.