public class PsAnimation extends PsObject implements java.lang.Runnable
PsTimeListenerIf
and register itself as listener in an instance this class.
By default, the time variable runs in the interval [0,100].
For usage, see interface PsTimeListenerIf
.
Since version 2.00 each animation has its own animationPanel.
PsAnimation_IP
,
PsTimeListenerIf
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
BACK_FORTH
Change direction, repeat mode when either end of animation is reached.
|
static int |
FAST_FORWARD
Play animation with speed determined by page increment of time ruler.
|
static int |
FAST_REWIND
Play animation with fast speed determined by page increment of time ruler
in backward direction.
|
static int |
FORWARD
Play animation with normal speed
determined by line increment of time ruler.
|
static int |
INTERPOL_LINEAR
Change direction, repeat mode when either end of animation is reached.
|
static int |
INTERPOL_NONE
Jump to other end, repeat mode when either end of animation is reached.
|
static int |
LOOP
Jump to other end, repeat mode when either end of animation is reached.
|
static int |
ONE_WAY
Stop animation, repeat mode when either end of animation is reached.
|
static int |
REWIND
Play animation with normal speed in backward direction
determined by line increment of time ruler.
|
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
Constructor and Description |
---|
PsAnimation() |
Modifier and Type | Method and Description |
---|---|
boolean |
addTimeListener(PsTimeListenerIf listener)
Register a new update listener, and in return, register this
animation in the time listener.
|
void |
enableKeys(boolean flag)
Set visibility of key buttons prevKey, nextKey etc. in animation panel.
|
PsDialog |
getAnimationPanel()
Get animation dialog to start and stop animation interactively.
|
int |
getInterpolType()
Get interpolation mode of animation.
|
double |
getMaxTime()
Get maximal time of animation interval.
|
double |
getMinTime()
Get minimal time of animation interval.
|
int |
getRepeat()
Get repeat mode of animation.
|
long |
getSleepInterval()
Get the length of the sleep interval between two timer events.
|
double |
getTime()
Get the current time of the animation.
|
double |
getTimePageIncr()
Get time increment of fast forward animation play.
|
double |
getTimeStepIncr()
Get time increment of standard animation play.
|
boolean |
hasAnimationPanel()
Query if animation has an animation dialog, or if it runs program controlled.
|
boolean |
hasTimeListener(PsTimeListenerIf listener)
Check whether an instance is a registered listener.
|
void |
init()
If instance has missing name then assign default name 'Object_NUMBER' where
number is the total number of already created instances.
|
boolean |
isModal()
Get flag if animation runs modal.
|
boolean |
isRunning()
Check if animation is running.
|
boolean |
removeTimeListener(PsTimeListenerIf listener)
Remove a registered listener from list of registered listeners.
|
void |
run()
Do the animation.
|
void |
setAnimationPanel(PsDialog panel)
Set animation panel, e.g. when different animations join a common panel.
|
void |
setInterpolType(int type)
Set interpolation mode of animation.
|
void |
setModal(boolean modal)
Set flag if animation runs modal.
|
void |
setPosition(int[] position)
Set position and size of animation panel in absolut screen coordinates.
|
void |
setRepeat(int repeat)
Set repeat mode of animation.
|
void |
setSleepInterval(long newInterval)
Set the length of the sleep interval between two timer events.
|
void |
setSpeedType(int speedType)
Set the speed type of this animation among four different types.
|
void |
setTime(double newTime)
Set the time of the animation and the animation panel.
|
void |
setTimeInterval(double aMin,
double aMax)
Set interval in which time varies.
|
void |
setTimeInterval(double aMin,
double aMax,
double aLineIncr,
double aPageIncr)
Set interval in which time varies, and increments for time slider.
|
void |
setTimePageIncr(double incr)
Set time increment of fast forward animation play.
|
void |
setTimeStepIncr(double incr)
Set time increment of standard animation play.
|
void |
start()
Start the animation with current speed type.
|
void |
start(int speedType)
Deprecated.
use setSpeed(speedType) followed by start().
|
void |
stop()
Stop animation.
|
void |
synchronize(boolean flag)
Switch synchronization flag and, if
flag==true update currentTime
with globalTime. |
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
public static final int FORWARD
public static final int REWIND
public static final int FAST_FORWARD
public static final int FAST_REWIND
public static final int ONE_WAY
public static final int LOOP
public static final int BACK_FORTH
public static final int INTERPOL_NONE
public static final int INTERPOL_LINEAR
public void init()
PsObject
public boolean addTimeListener(PsTimeListenerIf listener)
listener
- which is being registeredfalse
if listener already registered.hasTimeListener(PsTimeListenerIf)
,
removeTimeListener(PsTimeListenerIf)
public boolean hasTimeListener(PsTimeListenerIf listener)
listener
- which is being testedtrue
if registered listener found.addTimeListener(PsTimeListenerIf)
,
removeTimeListener(PsTimeListenerIf)
public boolean removeTimeListener(PsTimeListenerIf listener)
listener
- which was previously registered listener.false
if listener is not registered.addTimeListener(PsTimeListenerIf)
,
hasTimeListener(PsTimeListenerIf)
public long getSleepInterval()
public void setSleepInterval(long newInterval)
public void setTimeInterval(double aMin, double aMax, double aLineIncr, double aPageIncr)
public void setTimeInterval(double aMin, double aMax)
public double getMinTime()
public double getMaxTime()
public double getTimeStepIncr()
public void setTimeStepIncr(double incr)
public double getTimePageIncr()
public void setTimePageIncr(double incr)
public double getTime()
public void setTime(double newTime)
public void synchronize(boolean flag)
flag==true
update currentTime
with globalTime.public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PsObject
event
- carries a lot of informationPsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public void enableKeys(boolean flag)
public PsDialog getAnimationPanel()
public boolean hasAnimationPanel()
public void setAnimationPanel(PsDialog panel)
public void setPosition(int[] position)
public int getInterpolType()
INTERPOL_LINEAR
, INTERPOL_NONE
public void setInterpolType(int type)
type
- INTERPOL_LINEAR
, INTERPOL_NONE
public int getRepeat()
BACK_FORTH
, LOOP
, ONE_WAY
public void setRepeat(int repeat)
repeat
- BACK_FORTH
, LOOP
, ONE_WAY
public void setSpeedType(int speedType)
getTimeStepIncr()
,
or by interactively adjusting the line and page increment of the
time slider.speedType
- FORWARD
, FAST_FORWARD
, REWIND
, FAST_REWIND
getTimeStepIncr()
,
getTimePageIncr()
public boolean isModal()
setModal(boolean)
public void setModal(boolean modal)
start(int)
blocks
until the animation has stopped. By default, an animation is not
modal.
Note, if an animation runs modal in mode BACK_FORTH
one must avoid an infinite loop, for example, by showing the
animation panel which allows the user to stop the animation.
isModal()
public boolean isRunning()
public void start(int speedType)
speedType
- FORWARD
, FAST_FORWARD
, REWIND
, FAST_REWIND
public void start()
FORWARD
.public void stop()
public void run()
run
in interface java.lang.Runnable
"