Class Animation

java.lang.Object
org.eclipse.draw2d.Animation

public class Animation extends Object
A utility for coordinating figure animations. During animation, multiple animators are employed to capture the initial and final states for one or more figures. The animators then playback the animation by interpolating the intermediate states for each figure using the initial and final "keyframes".

An animator is usually stateless and represents an specific technique. Any state information is stored by the Animation utility. Therefore, one instance can be used with multiple figures. Animators hook into the validation mechanism for figures and connections. These hooks are used to capture the states, and to intercept the typical layout process to insert the interpolated state.

To indicate that animation is desired, clients must call markBegin() prior to invalidating any figures that are to be included in the animation. After this method is called, changes are made, and run() is invoked. The run method will force a validation pass to capture the final states, and then commence the animation. The animation is synchronous and the method does not return until the animation has completed.

Since:
3.2
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    getFinalState(Animator animator, IFigure figure)
    Returns the final animation state for the given figure.
    static Object
    getInitialState(Animator animator, IFigure figure)
    Returns the initial animation state for the given animator and figure.
    static float
    Returns the animation progress, where 0.0 < progress ≤ 1.0.
    static boolean
    Returns true if animation is in progress.
    static boolean
    Marks the beginning of the animation process.
    static void
    run()
    Runs animation using the recommended duration: 250 milliseconds.
    static void
    run(int duration)
    Captures the final states for the animation and then plays the animation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Animation

      public Animation()
  • Method Details

    • getFinalState

      public static Object getFinalState(Animator animator, IFigure figure)
      Returns the final animation state for the given figure.
      Parameters:
      animator - the animator for the figure
      figure - the figure being animated
      Returns:
      the final state
      Since:
      3.2
    • getInitialState

      public static Object getInitialState(Animator animator, IFigure figure)
      Returns the initial animation state for the given animator and figure. If no state was recorded, null is returned.
      Parameters:
      animator - the animator for the figure
      figure - the figure being animated
      Returns:
      the initial state
      Since:
      3.2
    • getProgress

      public static float getProgress()
      Returns the animation progress, where 0.0 < progress ≤ 1.0.
      Returns:
      the progress of the animation
      Since:
      3.2
    • isAnimating

      public static boolean isAnimating()
      Returns true if animation is in progress.
      Returns:
      true when animating
      Since:
      3.2
    • markBegin

      public static boolean markBegin()
      Marks the beginning of the animation process. If the beginning has already been marked, this has no effect.
      Returns:
      returns true if beginning was not previously marked
      Since:
      3.2
    • run

      public static void run()
      Runs animation using the recommended duration: 250 milliseconds.
      Since:
      3.2
      See Also:
    • run

      public static void run(int duration)
      Captures the final states for the animation and then plays the animation.
      Parameters:
      duration - the length of animation in milliseconds
      Since:
      3.2