edu.cmu.sun.animation
Class ScheduledAnimation

java.lang.Object
  extended by edu.cmu.sun.animation.ScheduledAnimation
All Implemented Interfaces:
java.lang.Comparable<ScheduledAnimation>
Direct Known Subclasses:
RotationAnimation, ScaleAnimation, ScheduledAnimationAction, TranslationAnimation, VisibilityAnimation

public abstract class ScheduledAnimation
extends java.lang.Object
implements java.lang.Comparable<ScheduledAnimation>

An abstract class representing an animation action. The animation can be scheduled to take place at a specific time, and last for a specified duration. Additionally, this class is compariable against it's start Time.

Author:
Braden Kowitz

Field Summary
(package private)  int duration
           
(package private)  int startTime
           
(package private)  Component3D target
           
 
Constructor Summary
ScheduledAnimation(Component3D target, int startTime, int duration)
          Create a new ScheduledAnimation.
 
Method Summary
 int compareTo(ScheduledAnimation sa)
          Used to sort ScheduledAnimation objects by their start time.
abstract  void doAnimation()
          Performs the animation required for this ScheduledAnimation.
 long getEndTime()
          The time the animation will be done.
 int getStartTime()
          The time, in msec from the start, this animation is to be performed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

target

Component3D target

startTime

int startTime

duration

int duration
Constructor Detail

ScheduledAnimation

public ScheduledAnimation(Component3D target,
                          int startTime,
                          int duration)
Create a new ScheduledAnimation. This should be added to an AnimationPlan.

Parameters:
target - Component to be animated.
startTime - Start time, in msec for this animation.
duration - The duration, in msec, for this animation.
Method Detail

getStartTime

public int getStartTime()
The time, in msec from the start, this animation is to be performed

Returns:
Time in msec

doAnimation

public abstract void doAnimation()
Performs the animation required for this ScheduledAnimation. Returns as soon as possible (nonblocking)


compareTo

public int compareTo(ScheduledAnimation sa)
Used to sort ScheduledAnimation objects by their start time.

Specified by:
compareTo in interface java.lang.Comparable<ScheduledAnimation>
Parameters:
sa -
Returns:
0 if same-time, -1 if earlier, 1 if later.

getEndTime

public long getEndTime()
The time the animation will be done.

Returns:
in msec.