Class RMAnimator
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.rm.graphics.RMAnimator
- All Implemented Interfaces:
Archivable
,RMPropertyChanger
,Cloneable
This class represents a timer for animation, holding things like a current time and max time.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An interface for classes that want to receive notification of certain animator events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnimatorListener
(RMAnimator.Listener aListener) Adds an animator listener.void
Adds a freeze frame for the animator's current time to the freeze-frame list.void
addNewborn
(Object anObj) Declare newBorn shapes so that if they are added at non-zero time, we won't get bogus initial values (after an explicit time change, they will start to accept changes).boolean
Returns whether the current time is not currently a key-frame.clone()
Standard clone implementation.void
This method tells the animator to move one frame backward (based on the frame rate).void
This method tells the animator to move one frame forward (based on the frame rate).fromXML
(RXArchiver anArchiver, RXElement anElement) XML unarchival.Returns the action to be performed at the end of animation.float
Returns the frame rate for this animator.int
Returns the update interval of the animator in milliseconds.Returns the list of key-frames present in animator owner's children.getKeyFrameTimes
(List<RMShape> theShapes, boolean includeImplied) Returns the list of key-frames present in the given list of shapes (assumed to be animator owner's descendants).boolean
getLoops()
Returns whether this animator loops when time hits max time.int
Returns the max time for this animator.float
Returns the animator max time in seconds.getOwner()
Returns the owner of the animator.int
Returns the play start time.boolean
Returns whether the time is reset to start value when animator stops.int
Returns the key-frame time that new anim records should be made relative to.float
Returns the number of seconds the animator has been playing for.int
getTime()
Returns the current time of the animator.float
Returns the animator time in seconds.boolean
isEmpty()
Returns whether animator owner's children are devoid of any animation records.boolean
Returns whether the animator owner's children should accept changes.boolean
Returns whether the given objects was created while at the current time.boolean
Returns whether the animator is currently in the act of playing.void
play()
Initiates a Swing timer to start automatically incrementing the animator's time (by frame rate increments).void
removeAnimatorListener
(RMAnimator.Listener aListener) Removes an animator listener.void
removeFramesAtTime
(int aTime) Removes records of the animator owner's children at a given time.void
removeFramesBetweenTimes
(int startTime, int endTime, boolean inclusive) Removes records of the animator owner's children in the given time range.protected void
resetShapeTimeline
(RMShape aShape) Resets a shape's timeline.void
scaleFrames
(int aStartTime, int newMaxTime) Scales records of the animator owner's children in the range from start to start + length to a given new length.void
setEnabled
(boolean aFlag) Sets whether the animator owner's children should accept changes.void
setEndAction
(String anAction) Sets the action to be performed at the end of animation.void
setFrameRate
(float aValue) Sets the frame rate for this animator.void
setInterval
(int anInterval) Sets the update interval of the animator in milliseconds.void
setLoops
(boolean aValue) Sets whether this animator loops when time hits max time.void
setMaxTime
(int aMaxTime) Sets the max time for this animator.void
setMaxTimeSeconds
(float aTime) Sets the max time in seconds.void
setOwner
(RMParentShape anObj) Sets the owner of the animator.void
setResetTimeOnStop
(boolean aFlag) Sets whether the time is reset to start value when animator stops.void
setScopeTime
(Integer aValue) Sets the key-frame time that new anim records should be made from.void
setTime
(int aTime) Sets the current time of the animator (clamped to maxTime), tells owner to setTime as well.void
setTimeSeconds
(float aTime) Sets the time in seconds.void
shiftFrames
(int fromTime, int aShiftTime) Shifts records of animator owner's children from the given from-time on, by the given by-time.void
stop()
Disables the Swing timer to stop automatically incrementing the animator's time.toString()
Returns a string description of the animator.toXML
(RXArchiver anArchiver) XML archival.Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
Constructor Details
-
RMAnimator
public RMAnimator()
-
-
Method Details
-
getOwner
Returns the owner of the animator. -
setOwner
Sets the owner of the animator. -
getTime
public int getTime()Returns the current time of the animator. -
setTime
public void setTime(int aTime) Sets the current time of the animator (clamped to maxTime), tells owner to setTime as well. -
getMaxTime
public int getMaxTime()Returns the max time for this animator. -
setMaxTime
public void setMaxTime(int aMaxTime) Sets the max time for this animator. May also call setTime() if animator's current time is beyond new max. -
getTimeSeconds
public float getTimeSeconds()Returns the animator time in seconds. -
setTimeSeconds
public void setTimeSeconds(float aTime) Sets the time in seconds. -
getMaxTimeSeconds
public float getMaxTimeSeconds()Returns the animator max time in seconds. -
setMaxTimeSeconds
public void setMaxTimeSeconds(float aTime) Sets the max time in seconds. -
getInterval
public int getInterval()Returns the update interval of the animator in milliseconds. -
setInterval
public void setInterval(int anInterval) Sets the update interval of the animator in milliseconds. -
getFrameRate
public float getFrameRate()Returns the frame rate for this animator. -
setFrameRate
public void setFrameRate(float aValue) Sets the frame rate for this animator. -
getEndAction
Returns the action to be performed at the end of animation. For example: Loop, Loop:5, Loop:5,3, Page:Next, Page:Last, etc. -
setEndAction
Sets the action to be performed at the end of animation. -
getLoops
public boolean getLoops()Returns whether this animator loops when time hits max time. -
setLoops
public void setLoops(boolean aValue) Sets whether this animator loops when time hits max time. -
getResetTimeOnStop
public boolean getResetTimeOnStop()Returns whether the time is reset to start value when animator stops. -
setResetTimeOnStop
public void setResetTimeOnStop(boolean aFlag) Sets whether the time is reset to start value when animator stops. -
getKeyFrameTimes
Returns the list of key-frames present in animator owner's children. -
getKeyFrameTimes
Returns the list of key-frames present in the given list of shapes (assumed to be animator owner's descendants). -
canFreezeFrame
public boolean canFreezeFrame()Returns whether the current time is not currently a key-frame. -
addFreezeFrame
public void addFreezeFrame()Adds a freeze frame for the animator's current time to the freeze-frame list. -
getScopeTime
public int getScopeTime()Returns the key-frame time that new anim records should be made relative to. -
setScopeTime
Sets the key-frame time that new anim records should be made from. -
play
public void play()Initiates a Swing timer to start automatically incrementing the animator's time (by frame rate increments). -
stop
public void stop()Disables the Swing timer to stop automatically incrementing the animator's time. -
frameForward
public void frameForward()This method tells the animator to move one frame forward (based on the frame rate). -
frameBackward
public void frameBackward()This method tells the animator to move one frame backward (based on the frame rate). -
isRunning
public boolean isRunning()Returns whether the animator is currently in the act of playing. -
getSecondsElapsed
public float getSecondsElapsed()Returns the number of seconds the animator has been playing for. -
getPlayStartTime
public int getPlayStartTime()Returns the play start time. -
addAnimatorListener
Adds an animator listener. -
removeAnimatorListener
Removes an animator listener. -
shiftFrames
public void shiftFrames(int fromTime, int aShiftTime) Shifts records of animator owner's children from the given from-time on, by the given by-time. -
scaleFrames
public void scaleFrames(int aStartTime, int newMaxTime) Scales records of the animator owner's children in the range from start to start + length to a given new length. -
isEmpty
public boolean isEmpty()Returns whether animator owner's children are devoid of any animation records. -
removeFramesAtTime
public void removeFramesAtTime(int aTime) Removes records of the animator owner's children at a given time. -
removeFramesBetweenTimes
public void removeFramesBetweenTimes(int startTime, int endTime, boolean inclusive) Removes records of the animator owner's children in the given time range. -
resetShapeTimeline
Resets a shape's timeline. -
isEnabled
public boolean isEnabled()Returns whether the animator owner's children should accept changes. -
setEnabled
public void setEnabled(boolean aFlag) Sets whether the animator owner's children should accept changes. This can be used strategically to disable the Animator so that it does not receive certain events (like each of the discrete moves in a mouse drag loop). Should be followed by enable (they can be nested). -
isNewborn
Returns whether the given objects was created while at the current time. -
addNewborn
Declare newBorn shapes so that if they are added at non-zero time, we won't get bogus initial values (after an explicit time change, they will start to accept changes). -
clone
Standard clone implementation.- Overrides:
clone
in classRMListenerList
-
toXML
XML archival.- Specified by:
toXML
in interfaceArchivable
-
fromXML
XML unarchival.- Specified by:
fromXML
in interfaceArchivable
-
toString
Returns a string description of the animator.
-