Eclipse Draw2d
3.8.0.201206011245

org.eclipse.draw2d
Class Animation

java.lang.Object
  extended by 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:
LayoutAnimator

Constructor Summary
Animation()
           
 
Method Summary
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 getProgress()
          Returns the animation progress, where 0.0 < progress ≤ 1.0.
static boolean isAnimating()
          Returns true if animation is in progress.
static boolean markBegin()
          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 Detail

Animation

public Animation()
Method Detail

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(int)

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

Eclipse Draw2d
3.8.0.201206011245

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.