An animation of a model bound to a ModelRenderable
.
Controls progress and state of the animation, updates the attached ModelRenderable
and
sends notifications via Animator.AnimatorListener
and Animator.AnimatorPauseListener
if needed.
ModelAnimator is created using a AnimationData
as an animation source and a ModelRenderable
as a target.
ModelAnimator only keeps WeakReference
s to the source and target of the
animation. To add a strong reference, attach a ModelRenderable
to a Node
.
TimeInterpolator
may be used to change the timing of the animation via setInterpolator(TimeInterpolator)
, but only monotonically increasing TimeInterpolator
s
are supported. The animation can not be made to play in reverse.
ModelAnimator must be used on the main thread. Animator.AnimatorListener
and Animator.AnimatorPauseListener
will be called on the main thread.
Constants
int | INFINITE | Used with the setRepeatCount(int) property to repeat the ModelAnimator indefinitely. |
Inherited Constants
Public Constructors
Public Methods
String |
getName()
Returns the name of the
AnimationData . |
int |
getRepeatCount()
Returns the number of times the ModelAnimator should repeat, or
INFINITE . |
ModelRenderable |
getTarget()
Gets the
ModelRenderable this ModelAnimator applies to or null if there is none. |
ModelAnimator |
setDuration(long duration)
Sets the duration of the ModelAnimator.
|
void |
setInterpolator(TimeInterpolator value)
Sets the time interpolator used in calculating the elapsed fraction of the ModelAnimator.
|
void |
setRepeatCount(int repeatCount)
Sets how many times the ModelAnimator should be repeated.
|
void | |
void |
start()
Starts this ModelAnimator at the beginning.
|
Inherited Methods
Constants
public static final int INFINITE
Used with the setRepeatCount(int)
property to repeat the ModelAnimator indefinitely.
Public Constructors
public ModelAnimator (AnimationData source, ModelRenderable target)
Constructs a new ModelAnimator.
Parameters
source | Defines how the target will change during the animation. |
---|---|
target | Determines which ModelRenderable will be modified during animation.
Target may be null, but
|
Public Methods
public String getName ()
Returns the name of the AnimationData
. This may return "" if there is no connected
AnimationData
or it has been garbage collected.
public int getRepeatCount ()
Returns the number of times the ModelAnimator should repeat, or INFINITE
. The default
value is 0.
public ModelRenderable getTarget ()
Gets the ModelRenderable
this ModelAnimator applies to or null if there is none.
public ModelAnimator setDuration (long duration)
Sets the duration of the ModelAnimator.
Parameters
duration |
---|
Throws
IllegalArgumentException} for negative durations and IllegalStateException if the ModelAnimator has already started.
|
public void setInterpolator (TimeInterpolator value)
Sets the time interpolator used in calculating the elapsed fraction of the ModelAnimator.
Only monotonically increasing TimeInterpolators are supported. The default value is LinearInterpolator
by default.
Parameters
value | the interpolator to be used by this ModelAnimator |
---|
public void setRepeatCount (int repeatCount)
Sets how many times the ModelAnimator should be repeated. If repeatCount is 0, the ModelAnimator plays once. The initial setting for repeatCount is 0.
Parameters
repeatCount | the number of times the ModelAnimator should be repeated or INFINITE .
|
---|
public void setTarget (ModelRenderable target)
Sets the ModelRenderable
this ModelAnimator applies to.
Parameters
target | The object being animated. This value may be null. |
---|
public void start ()
Starts this ModelAnimator at the beginning.
Throws
IllegalStateException | if two ModelAnimators are started on the same ModelRenderable at the same time or if isStarted() is already true.
|
---|