vmm3d.core
Interface Animation
-
- All Known Implementing Classes:
- BasicAnimator, OsculatingCircleAnimation, ParallelCurveAnimation, ThreadedAnimation, TimerAnimation
public interface AnimationThe common interface for two different types of animations, ThreadedAnimation and TimerAnimation. Any Animation can be started, stopped, and paused. Its speed can be modified using thesetTimeDilation(double)method. All animations send change events when they are stopped or started. Although animations can run on their own, most animations will probably be associated with Displays; see theDisplayfor more information on this, in particularDisplay.installAnimation(Animation). See theThreadedAnimationclass and theTimerAnimationclass for information about writing animations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidaddChangeListener(javax.swing.event.ChangeListener listener)Register a ChangeListener to receive change events from the animation.voidcancel()Stop the Animation.java.lang.StringgetStatusText(boolean running)Returns text to be displayed in the display's status bar while this animation is installed.doublegetTimeDilation()Gets the factor that is multiplied by all time period specifications.booleanisPaused()Tells whether the animation is paused.booleanisRunning()Tests whether the Animation is still running.voidremoveChangeListener(javax.swing.event.ChangeListener listener)De-register a ChangeListener from this animation, if it is currently registered to receive change events.voidsetPaused(boolean paused)Sets whether a running animation is paused or not.voidsetTimeDilation(double dilationFactor)Sets a factor that is multiplied by all time period specifications.voidstart()Start the animation running.
-
-
-
Method Detail
-
start
void start()
Start the animation running. Animations don't start automatically. The start() method must be called in order to start the animation.
-
cancel
void cancel()
Stop the Animation. Some animations will continue indefinitely until this method is called; others will stop automatically after some period of time.
-
isRunning
boolean isRunning()
Tests whether the Animation is still running. An animation is running from the time its start() method is called until either it stops on its own or its cancel() method is called. An animation that has been paused is still considered to be running.
-
setPaused
void setPaused(boolean paused)
Sets whether a running animation is paused or not. Has no effect on an animation that is not running.- Parameters:
paused- whether the running animation should be in the paused state.
-
isPaused
boolean isPaused()
Tells whether the animation is paused.- Returns:
- returns true if the animation is running but is in a paused state; returns false if it is not running or if it is running but is not paused.
-
setTimeDilation
void setTimeDilation(double dilationFactor)
Sets a factor that is multiplied by all time period specifications. A value greater than one will slow down the animation; a value less than one will speed it up (although only within the limit imposed by the actual processing time needed to run the animation).- Parameters:
dilationFactor- A non-negative number that will be multiplied by all time measurements.
-
getTimeDilation
double getTimeDilation()
Gets the factor that is multiplied by all time period specifications. Defatult value is 1, meaning normal running speed for the animation.
-
addChangeListener
void addChangeListener(javax.swing.event.ChangeListener listener)
Register a ChangeListener to receive change events from the animation. An animation sends a change event at least when it starts and when it stops.- Parameters:
listener- a ChangeListener that is registered to receive change events from this animation.
-
removeChangeListener
void removeChangeListener(javax.swing.event.ChangeListener listener)
De-register a ChangeListener from this animation, if it is currently registered to receive change events.- Parameters:
listener- to be de-registered as a ChangeListener from this animation.
-
getStatusText
java.lang.String getStatusText(boolean running)
Returns text to be displayed in the display's status bar while this animation is installed.- Parameters:
running- Tells whether the animation is running or paused, so text can depend on this value.- Returns:
- the text to displayed, or null to use the default text "Animation Running" or "Animation Paused"
-
-
DMelt 3.0 © DataMelt by jWork.ORG