vmm3d.core
Class BasicAnimator
- java.lang.Object
-
- vmm3d.core.TimerAnimation
-
- vmm3d.core.BasicAnimator
-
- All Implemented Interfaces:
- Animation
public class BasicAnimator extends TimerAnimation
A BasicAnimator can animate one or more Animateable objects. It is a fairly simple extension of TimerAnimation that keeps a list of Animateable items and in each frame calls each item'sAnimateable.setFractionComplete(double)method. In fact, all Animateable objects in the vmm core are Animateable Parameters such asRealParamAnimateable, and BasicAnimators are used only for Morphing animations.It is also possible to add a
RealParamAnimateableorComplexParamAnimateablewith specified start and end values, which will be used instead of the start and end values stored in the parameter itself.
-
-
Field Summary
-
Fields inherited from class vmm3d.core.TimerAnimation
LOOP, ONCE, OSCILLATE
-
-
Constructor Summary
Constructors Constructor and Description BasicAnimator()Create a BasicAnimator with no items, with 100 frames and 50 millseconds per frame.BasicAnimator(Animateable item)Create a BasicAnimator with one Animateable item, with 100 frames and 50 millseconds per frame.BasicAnimator(Animateable[] items, int frames, int millisecondsPerFrame)Create a BasicAnimator with several animated itemss, and with a specified number of frames and delay per frame.BasicAnimator(Animateable item, int frames, int millisecondsPerFrame)Create a BasicAnimator with one item, with a specified number of frames and delay per frame.BasicAnimator(int frames)Create a BasicAnimator with no items, with a specified number of frames, and with 50 millisconds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddAnimatedItem(Animateable item)Add an Animateable item to the list of items that change during this animation.voidaddWithCustomLimits(ComplexParamAnimateable item, Complex start, Complex end)Adds a ComplexParamAniamteable to this animator, with specified start and end values for the animation.voidaddWithCustomLimits(RealParamAnimateable item, double start, double end)Adds a RealParamAniamteable to this animator, with specified start and end values for the animation.voidaddWithCustomValue(ComplexParam item, Complex value)Adds a ComplexParam to this animator, with specified value for the animation.voidaddWithCustomValue(IntegerParam item, int value)Adds an IntegerParam to this animator, with specified value for the animation.voidaddWithCustomValue(RealParam item, double value)Adds a RealParam to this animator, with specified value for the animation.voidcancel()Cancels a running animation.booleangetRestoreParameterValues()Get the setting of the restoreParameterValues property.java.lang.StringgetStatusText(boolean running)Returns null to indicate that the default text ("Animation Running" or "Animation Paused" in the English version) should be shown in the display's status bar.voidsetRestoreParameterValues(boolean restoreParameterValues)Set the restoreParameterValues property.voidstart()Starts the animation running.-
Methods inherited from class vmm3d.core.TimerAnimation
addChangeListener, getFilmstrip, getFilmstripFrameImage, getFireFrameEvents, getFrameNumber, getFrames, getInitialDelay, getLooping, getMillisecondsPerFrame, getTimeDilation, getUseFilmstrip, isPaused, isRunning, removeChangeListener, setFireFrameEvents, setFrames, setInitialDelay, setLooping, setMillisecondsPerFrame, setPaused, setTimeDilation, setUseFilmstrip
-
-
-
-
Constructor Detail
-
BasicAnimator
public BasicAnimator()
Create a BasicAnimator with no items, with 100 frames and 50 millseconds per frame. Animated items can be added with theaddAnimatedItemmethod.
-
BasicAnimator
public BasicAnimator(int frames)
Create a BasicAnimator with no items, with a specified number of frames, and with 50 millisconds. Animated items can be added with theaddAnimatedItemmethod.
-
BasicAnimator
public BasicAnimator(Animateable item)
Create a BasicAnimator with one Animateable item, with 100 frames and 50 millseconds per frame. More animated items could be added with theaddAnimatedItemmethod.- Parameters:
item- An item to be animated by this animation. Can be null, in which case the animation has no items initially.
-
BasicAnimator
public BasicAnimator(Animateable item, int frames, int millisecondsPerFrame)
Create a BasicAnimator with one item, with a specified number of frames and delay per frame. More animated items could be added with theaddAnimatedItemmethod.- Parameters:
item- An item to be animated by this animation. Can be null, in which case the animation has no items initially.frames- The number of frames in the animationmillisecondsPerFrame- The desired number of milliseconds for each frame
-
BasicAnimator
public BasicAnimator(Animateable[] items, int frames, int millisecondsPerFrame)
Create a BasicAnimator with several animated itemss, and with a specified number of frames and delay per frame.- Parameters:
items- An array of items to be animated by this animation. Can be null, in which case the animation has no items initially.frames- The number of frames in the animation.millisecondsPerFrame- The desired number of milliseconds for each frame
-
-
Method Detail
-
getRestoreParameterValues
public boolean getRestoreParameterValues()
Get the setting of the restoreParameterValues property.- See Also:
setRestoreParameterValues(boolean)
-
setRestoreParameterValues
public void setRestoreParameterValues(boolean restoreParameterValues)
Set the restoreParameterValues property. If this property is true, then this BasicAnimator will save the value of any Parameter among its Animateable objects at the beginning of the animation, and it will restore those values when the animation ends. The default value is true. The value must be set before the animation is started for it to have any effect.
-
addAnimatedItem
public void addAnimatedItem(Animateable item)
Add an Animateable item to the list of items that change during this animation.- Parameters:
item- The item to be added. If null, nothing is done.
-
addWithCustomValue
public void addWithCustomValue(IntegerParam item, int value)
Adds an IntegerParam to this animator, with specified value for the animation. This value is assigned to the paramter at the beginning of the animation and is used throughout the animation, the old value is restored at the end of the animation, provided that the restoreParameterValues property of this animation is true.- Parameters:
item- the parameter whose value is to be fixed at a specified value throughout the animation. If this is null, nothing is done and no error occurs.
-
addWithCustomValue
public void addWithCustomValue(RealParam item, double value)
Adds a RealParam to this animator, with specified value for the animation. This value is assigned to the paramter at the beginning of the animation and is used throughout the animation, the old value is restored at the end of the animation, provided that the restoreParameterValues property of this animation is true.- Parameters:
item- the parameter whose value is to be fixed at a specified value throughout the animation. If this is null, nothing is done and no error occurs.
-
addWithCustomValue
public void addWithCustomValue(ComplexParam item, Complex value)
Adds a ComplexParam to this animator, with specified value for the animation. This value is assigned to the paramter at the beginning of the animation and is used throughout the animation, the old value is restored at the end of the animation, provided that the restoreParameterValues property of this animation is true.- Parameters:
item- the parameter whose value is to be fixed at a specified value throughout the animation. If this is null, nothing is done and no error occurs.value- the value for the parameter. If this is null, 0 is used.
-
addWithCustomLimits
public void addWithCustomLimits(RealParamAnimateable item, double start, double end)
Adds a RealParamAniamteable to this animator, with specified start and end values for the animation. These values are used instead of the start and end values stored in the parameter itself, and those values are not modified by the animation. (This is meant to allow, for example, the creation of "custom morphs" in addition to the standard Morph and Cyclic Morph, which always use the start and end values specified by the user and stored in the parameters.)- Parameters:
item- the parameter to be animated. If this is null, nothing is done and no error occurs.
-
addWithCustomLimits
public void addWithCustomLimits(ComplexParamAnimateable item, Complex start, Complex end)
Adds a ComplexParamAniamteable to this animator, with specified start and end values for the animation. These values are used instead of the start and end values stored in the parameter itself, and those values are not modified by the animation. If the start or end value is null, 0 is used.- Parameters:
item- the parameter to be animated. If this is null, nothing is done and no error occurs.
-
start
public final void start()
Description copied from class:TimerAnimationStarts the animation running. An animation does not start running automatically, but only when this method is called. If the animation is already runnning, this has no effect. If the animation has already run and has finished for any reason, it is restarted from the beginning.- Specified by:
startin interfaceAnimation- Overrides:
startin classTimerAnimation
-
cancel
public final void cancel()
Description copied from class:TimerAnimationCancels a running animation. If this animation is not running, this has no effect.- Specified by:
cancelin interfaceAnimation- Overrides:
cancelin classTimerAnimation
-
getStatusText
public java.lang.String getStatusText(boolean running)
Returns null to indicate that the default text ("Animation Running" or "Animation Paused" in the English version) should be shown in the display's status bar. This can be overridden in a subclass to show a different status message.- Specified by:
getStatusTextin interfaceAnimation- Overrides:
getStatusTextin classTimerAnimation- Parameters:
running- tells whether the animation is currently running.- Returns:
- the text to displayed, or null to use the default text "Animation Running" or "Animation Paused"
-
-
DMelt 3.0 © DataMelt by jWork.ORG