Package org.eclipse.draw2d

# Class Animator

java.lang.Object
org.eclipse.draw2d.Animator

Direct Known Subclasses:
  `LayoutAnimator`, `RoutingAnimator`

public abstract class Animator extends Object
Animates some aspect of a figure. Each animator will capture some of the effects of validation of the figures.

Animators must be hooked to figure in special ways. Refer to each implementation for the specific requirements. Animators are generally stateless, which allows them to be shared and prevents them from leaking memory.

Since:
  3.2

## Method Summary

Modifier and Type
Method
Description
`void`
`capture(IFigure figure)`
Captures the final state of the given figure.
`protected abstract Object`
`getCurrentState(IFigure figure)`
Returns an object encapsulating the current state of the figure.
`void`
`init(IFigure figure)`
Sets up the animator for the given figure to be animated.
`protected boolean`
`playback(IFigure figure)`
Plays back the animation for the given figure and returns `true` if successful.
`void`
`playbackStarting(IFigure figure)`
Sent as playback is starting for a given figure.
`protected void`
`recordFinalState(IFigure figure)`
Records the final state information for a figure.
`protected void`
`recordInitialState(IFigure figure)`
Records initial state information for the given figure.
`void`
`tearDown(IFigure figure)`
Reverts any temporary changes made to the figure during animation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### capture

public void capture(IFigure figure)
Captures the final state of the given figure. This method is called once after the update manager has completed validation of all invalid figures.

Parameters:
  `figure` - the container
Since:
  3.2

### getCurrentState

protected abstract Object getCurrentState(IFigure figure)
Returns an object encapsulating the current state of the figure. This method is called to capture both the initial and final states.

Parameters:
  `figure` - the figure
Returns:
  the current state
Since:
  3.2

### playback

protected boolean playback(IFigure figure)
Plays back the animation for the given figure and returns `true` if successful. This method does nothing by default and return `false`.

Parameters:
  `figure` - the figure being animated
Returns:
  `true` if playback was successful
Since:
  3.2

### playbackStarting

public void playbackStarting(IFigure figure)
Sent as playback is starting for a given figure.

Parameters:
  `figure` - the figure
Since:
  3.2

### recordFinalState

protected void recordFinalState(IFigure figure)
Records the final state information for a figure.

Parameters:
  `figure` - the figure
Since:
  3.2

### recordInitialState

protected void recordInitialState(IFigure figure)
Records initial state information for the given figure.

Parameters:
  `figure` - the container.
Since:
  3.2

### init

public void init(IFigure figure)
Sets up the animator for the given figure to be animated. This method is called exactly once time prior to any layouts happening. The animator can capture the figure's current state, and set any animation-time settings for the figure. Changes made to the figure should be reverted in `tearDown(IFigure)`.

Parameters:
  `figure` - the animated figure
Since:
  3.2

### tearDown

public void tearDown(IFigure figure)
Reverts any temporary changes made to the figure during animation. This method is called exactly once after all animation has been completed. Subclasses should extend this method to revert any changes.

Parameters:
  `figure` - the animated figure
Since:
  3.2
See Also:
  - `init(IFigure)`