Module javafx.graphics
Package javafx.animation

# Class Animation

java.lang.Object
javafx.animation.Animation

Direct Known Subclasses:
  `Timeline`, `Transition`

public abstract class Animation extends Object
The class `Animation` provides the core functionality of all animations used in the JavaFX runtime.

An animation can run in a loop by setting `cycleCount`. To make an animation run back and forth while looping, set the `autoReverse` -flag.

Call `play()` or `playFromStart()` to play an `Animation` . The `Animation` progresses in the direction and speed specified by `rate`, and stops when its duration is elapsed. An `Animation` with indefinite duration (a `cycleCount` of `INDEFINITE`) runs repeatedly until the `stop()` method is explicitly called, which will stop the running `Animation` and reset its play head to the initial position.

An `Animation` can be paused by calling `pause()`, and the next `play()` call will resume the `Animation` from where it was paused.

An `Animation`'s play head can be randomly positioned, whether it is running or not. If the `Animation` is running, the play head jumps to the specified position immediately and continues playing from new position. If the `Animation` is not running, the next `play()` will start the `Animation` from the specified position.

Inverting the value of `rate` toggles the play direction.

Since:
  JavaFX 2.0
See Also:
  - `Timeline`
  - `Transition`

## Property Summary

Properties
Type
Property
Description
`final BooleanProperty`
`autoReverse`
Defines whether this `Animation` reverses direction on alternating cycles.
`final ReadOnlyDoubleProperty`
`currentRate`
Read-only variable to indicate current direction/speed at which the `Animation` is being played.
`final ReadOnlyObjectProperty<Duration>`
`currentTime`
Defines the `Animation`'s play head position.
`final IntegerProperty`
`cycleCount`
Defines the number of cycles in this animation.
`final ReadOnlyObjectProperty<Duration>`
`cycleDuration`
Read-only variable to indicate the duration of one cycle of this `Animation`: the time it takes to play from time 0 to the end of the Animation (at the default `rate` of 1.0).
`final ObjectProperty<Duration>`
`delay`
Delays the start of an animation.
`final ObjectProperty<EventHandler<ActionEvent>>`
`onFinished`
The action to be executed at the conclusion of this `Animation`.
`final DoubleProperty`
`rate`
Defines the direction/speed at which the `Animation` is expected to be played.
`final ReadOnlyObjectProperty<Animation.Status>`
`status`
The status of the `Animation`.
`final ReadOnlyObjectProperty<Duration>`
`totalDuration`
Read-only variable to indicate the total duration of this `Animation`, including repeats.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`Animation.Status`
The possible states for `status`.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`INDEFINITE`
Used to specify an animation that repeats indefinitely, until the `stop()` method is called.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Animation()`
The constructor of `Animation`.
`protected`
`Animation(double targetFramerate)`
The constructor of `Animation`.

## Method Summary

Modifier and Type
Method
Description
`final BooleanProperty`
`autoReverseProperty()`
Defines whether this `Animation` reverses direction on alternating cycles.
`final ReadOnlyDoubleProperty`
`currentRateProperty()`
Read-only variable to indicate current direction/speed at which the `Animation` is being played.
`final ReadOnlyObjectProperty<Duration>`
`currentTimeProperty()`
Defines the `Animation`'s play head position.
`final IntegerProperty`
`cycleCountProperty()`
Defines the number of cycles in this animation.
`final ReadOnlyObjectProperty<Duration>`
`cycleDurationProperty()`
Read-only variable to indicate the duration of one cycle of this `Animation`: the time it takes to play from time 0 to the end of the Animation (at the default `rate` of 1.0).
`final ObjectProperty<Duration>`
`delayProperty()`
Delays the start of an animation.
`final ObservableMap<String,Duration>`
`getCuePoints()`
The cue points can be used to mark important positions of the `Animation`.
`final double`
`getCurrentRate()`
Gets the value of the `currentRate` property.
`final Duration`
`getCurrentTime()`
Gets the value of the `currentTime` property.
`final int`
`getCycleCount()`
Gets the value of the `cycleCount` property.
`final Duration`
`getCycleDuration()`
Gets the value of the `cycleDuration` property.
`final Duration`
`getDelay()`
Gets the value of the `delay` property.
`final EventHandler<ActionEvent>`
`getOnFinished()`
Gets the value of the `onFinished` property.
`final double`
`getRate()`
Gets the value of the `rate` property.
`final Animation.Status`
`getStatus()`
Gets the value of the `status` property.
`final double`
`getTargetFramerate()`
The target framerate is the maximum framerate at which this `Animation` will run, in frames per second.
`final Duration`
`getTotalDuration()`
Gets the value of the `totalDuration` property.
`final boolean`
`isAutoReverse()`
Gets the value of the `autoReverse` property.
`void`
`jumpTo(String cuePoint)`
Jumps to a predefined position in this `Animation`.
`void`
`jumpTo(Duration time)`
Jumps to a given position in this `Animation`.
`final ObjectProperty<EventHandler<ActionEvent>>`
`onFinishedProperty()`
The action to be executed at the conclusion of this `Animation`.
`void`
`pause()`
Pauses the animation.
`void`
`play()`
Plays `Animation` from current position in the direction indicated by `rate`.
`void`
`playFrom(String cuePoint)`
A convenience method to play this `Animation` from a predefined position.
`void`
`playFrom(Duration time)`
A convenience method to play this `Animation` from a specific position.
`void`
`playFromStart()`
Plays an `Animation` from initial position in forward direction.
`final DoubleProperty`
`rateProperty()`
Defines the direction/speed at which the `Animation` is expected to be played.
`final void`
`setAutoReverse(boolean value)`
Sets the value of the `autoReverse` property.
`final void`
`setCycleCount(int value)`
Sets the value of the `cycleCount` property.
`protected final void`
`setCycleDuration(Duration value)`
Sets the value of the `cycleDuration` property.
`final void`
`setDelay(Duration value)`
Sets the value of the `delay` property.
`final void`
`setOnFinished(EventHandler<ActionEvent> value)`
Sets the value of the `onFinished` property.
`final void`
`setRate(double value)`
Sets the value of the `rate` property.
`protected final void`
`setStatus(Animation.Status value)`
Sets the value of the `status` property.
`final ReadOnlyObjectProperty<Animation.Status>`
`statusProperty()`
The status of the `Animation`.
`void`
`stop()`
Stops the animation and resets the play head to its initial position.
`final ReadOnlyObjectProperty<Duration>`
`totalDurationProperty()`
Read-only variable to indicate the total duration of this `Animation`, including repeats.

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

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

## Property Details

### rate

public final DoubleProperty rateProperty
Defines the direction/speed at which the `Animation` is expected to be played.

The absolute value of `rate` indicates the speed at which the `Animation` is to be played, while the sign of `rate` indicates the direction. A positive value of `rate` indicates forward play, a negative value indicates backward play and `0.0` to stop a running `Animation`.

Rate `1.0` is normal play, `2.0` is 2 time normal, `-1.0` is backwards, etc.

Inverting the rate of a running `Animation` will cause the `Animation` to reverse direction in place and play back over the portion of the `Animation` that has already elapsed.

Default value:
  1.0
See Also:
  - `getRate()`
  - `setRate(double)`
  - `rateProperty()`

### currentRate

public final ReadOnlyDoubleProperty currentRateProperty
Read-only variable to indicate current direction/speed at which the `Animation` is being played.

`currentRate` is not necessary equal to `rate`. `currentRate` is set to `0.0` when animation is paused or stopped. `currentRate` may also point to different direction during reverse cycles when `autoReverse` is `true`

Default value:
  0.0
See Also:
  - `getCurrentRate()`
  - `currentRateProperty()`

### cycleDuration

public final ReadOnlyObjectProperty<Duration> cycleDurationProperty
Read-only variable to indicate the duration of one cycle of this `Animation`: the time it takes to play from time 0 to the end of the Animation (at the default `rate` of 1.0).

Default value:
  0ms
See Also:
  - `getCycleDuration()`
  - `setCycleDuration(Duration)`
  - `cycleDurationProperty()`

### totalDuration

public final ReadOnlyObjectProperty<Duration> totalDurationProperty
Read-only variable to indicate the total duration of this `Animation`, including repeats. A `Animation` with a `cycleCount` of `Animation.INDEFINITE` will have a `totalDuration` of `Duration.INDEFINITE`.

This is set to cycleDuration * cycleCount.

Default value:
  0ms
See Also:
  - `getTotalDuration()`
  - `totalDurationProperty()`

### currentTime

public final ReadOnlyObjectProperty<Duration> currentTimeProperty
Defines the `Animation`'s play head position.

Default value:
  0ms
See Also:
  - `getCurrentTime()`
  - `currentTimeProperty()`

### delay

public final ObjectProperty<Duration> delayProperty
Delays the start of an animation. Cannot be negative. Setting to a negative number will result in `IllegalArgumentException`.

Default value:
  0ms
See Also:
  - `getDelay()`
  - `setDelay(Duration)`
  - `delayProperty()`

### cycleCount

public final IntegerProperty cycleCountProperty
Defines the number of cycles in this animation. The `cycleCount` may be `INDEFINITE` for animations that repeat indefinitely, but must otherwise be > 0.

It is not possible to change the `cycleCount` of a running `Animation`. If the value of `cycleCount` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.

Default value:
  1.0
See Also:
  - `getCycleCount()`
  - `setCycleCount(int)`
  - `cycleCountProperty()`

### autoReverse

public final BooleanProperty autoReverseProperty
Defines whether this `Animation` reverses direction on alternating cycles. If `true`, the `Animation` will proceed forward on the first cycle, then reverses on the second cycle, and so on. Otherwise, animation will loop such that each cycle proceeds forward from the start. It is not possible to change the `autoReverse` flag of a running `Animation`. If the value of `autoReverse` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.

Default value:
  false
See Also:
  - `isAutoReverse()`
  - `setAutoReverse(boolean)`
  - `autoReverseProperty()`

### status

public final ReadOnlyObjectProperty<Animation.Status> statusProperty
The status of the `Animation`. In `Animation` can be in one of three states: `Animation.Status.STOPPED`, `Animation.Status.PAUSED` or `Animation.Status.RUNNING`.

See Also:
  - `getStatus()`
  - `setStatus(Animation.Status)`
  - `statusProperty()`

### onFinished

public final ObjectProperty<EventHandler<ActionEvent>> onFinishedProperty
The action to be executed at the conclusion of this `Animation`.

Default value:
  null
See Also:
  - `getOnFinished()`
  - `setOnFinished(EventHandler)`
  - `onFinishedProperty()`

## Field Details

### INDEFINITE

public static final int INDEFINITE
Used to specify an animation that repeats indefinitely, until the `stop()` method is called.

See Also:
  - Constant Field Values

## Constructor Details

### Animation

protected Animation(double targetFramerate)
The constructor of `Animation`. This constructor allows to define a target framerate.

Parameters:
  `targetFramerate` - The custom target frame rate for this `Animation`
See Also:
  - `getTargetFramerate()`

### Animation

protected Animation()
The constructor of `Animation`.

## Method Details

### setRate

public final void setRate(double value)
Sets the value of the `rate` property.

Property description:
  Defines the direction/speed at which the `Animation` is expected to be played.

  The absolute value of `rate` indicates the speed at which the `Animation` is to be played, while the sign of `rate` indicates the direction. A positive value of `rate` indicates forward play, a negative value indicates backward play and `0.0` to stop a running `Animation`.

  Rate `1.0` is normal play, `2.0` is 2 time normal, `-1.0` is backwards, etc.

  Inverting the rate of a running `Animation` will cause the `Animation` to reverse direction in place and play back over the portion of the `Animation` that has already elapsed.

Default value:
  1.0
Parameters:
  `value` - the value for the `rate` property
See Also:
  - `getRate()`
  - `rateProperty()`

### getRate

public final double getRate()
Gets the value of the `rate` property.

Property description:
  Defines the direction/speed at which the `Animation` is expected to be played.

  The absolute value of `rate` indicates the speed at which the `Animation` is to be played, while the sign of `rate` indicates the direction. A positive value of `rate` indicates forward play, a negative value indicates backward play and `0.0` to stop a running `Animation`.

  Rate `1.0` is normal play, `2.0` is 2 time normal, `-1.0` is backwards, etc.

  Inverting the rate of a running `Animation` will cause the `Animation` to reverse direction in place and play back over the portion of the `Animation` that has already elapsed.

Default value:
  1.0
Returns:
  the value of the `rate` property
See Also:
  - `setRate(double)`
  - `rateProperty()`

### rateProperty

public final DoubleProperty rateProperty()
Defines the direction/speed at which the `Animation` is expected to be played.

The absolute value of `rate` indicates the speed at which the `Animation` is to be played, while the sign of `rate` indicates the direction. A positive value of `rate` indicates forward play, a negative value indicates backward play and `0.0` to stop a running `Animation`.

Rate `1.0` is normal play, `2.0` is 2 time normal, `-1.0` is backwards, etc.

Inverting the rate of a running `Animation` will cause the `Animation` to reverse direction in place and play back over the portion of the `Animation` that has already elapsed.

Default value:
  1.0
Returns:
  the `rate` property
See Also:
  - `getRate()`
  - `setRate(double)`

### getCurrentRate

public final double getCurrentRate()
Gets the value of the `currentRate` property.

Property description:
  Read-only variable to indicate current direction/speed at which the `Animation` is being played.

  `currentRate` is not necessary equal to `rate`. `currentRate` is set to `0.0` when animation is paused or stopped. `currentRate` may also point to different direction during reverse cycles when `autoReverse` is `true`

Default value:
  0.0
Returns:
  the value of the `currentRate` property
See Also:
  - `currentRateProperty()`

### currentRateProperty

public final ReadOnlyDoubleProperty currentRateProperty()
Read-only variable to indicate current direction/speed at which the `Animation` is being played.

`currentRate` is not necessary equal to `rate`. `currentRate` is set to `0.0` when animation is paused or stopped. `currentRate` may also point to different direction during reverse cycles when `autoReverse` is `true`

Default value:
  0.0
Returns:
  the `currentRate` property
See Also:
  - `getCurrentRate()`

### setCycleDuration

protected final void setCycleDuration(Duration value)
Sets the value of the `cycleDuration` property.

Property description:
  Read-only variable to indicate the duration of one cycle of this `Animation`: the time it takes to play from time 0 to the end of the Animation (at the default `rate` of 1.0).
Default value:
  0ms
Parameters:
  `value` - the value for the `cycleDuration` property
See Also:
  - `getCycleDuration()`
  - `cycleDurationProperty()`

### getCycleDuration

public final Duration getCycleDuration()
Gets the value of the `cycleDuration` property.

Property description:
  Read-only variable to indicate the duration of one cycle of this `Animation`: the time it takes to play from time 0 to the end of the Animation (at the default `rate` of 1.0).
Default value:
  0ms
Returns:
  the value of the `cycleDuration` property
See Also:
  - `setCycleDuration(Duration)`
  - `cycleDurationProperty()`

### cycleDurationProperty

public final ReadOnlyObjectProperty<Duration> cycleDurationProperty()
Read-only variable to indicate the duration of one cycle of this `Animation`: the time it takes to play from time 0 to the end of the Animation (at the default `rate` of 1.0).

Default value:
  0ms
Returns:
  the `cycleDuration` property
See Also:
  - `getCycleDuration()`
  - `setCycleDuration(Duration)`

### getTotalDuration

public final Duration getTotalDuration()
Gets the value of the `totalDuration` property.

Property description:
  Read-only variable to indicate the total duration of this `Animation`, including repeats. A `Animation` with a `cycleCount` of `Animation.INDEFINITE` will have a `totalDuration` of `Duration.INDEFINITE`.

  This is set to cycleDuration * cycleCount.

Default value:
  0ms
Returns:
  the value of the `totalDuration` property
See Also:
  - `totalDurationProperty()`

### totalDurationProperty

public final ReadOnlyObjectProperty<Duration> totalDurationProperty()
Read-only variable to indicate the total duration of this `Animation`, including repeats. A `Animation` with a `cycleCount` of `Animation.INDEFINITE` will have a `totalDuration` of `Duration.INDEFINITE`.

This is set to cycleDuration * cycleCount.

Default value:
  0ms
Returns:
  the `totalDuration` property
See Also:
  - `getTotalDuration()`

### getCurrentTime

public final Duration getCurrentTime()
Gets the value of the `currentTime` property.

Property description:
  Defines the `Animation`'s play head position.
Default value:
  0ms
Returns:
  the value of the `currentTime` property
See Also:
  - `currentTimeProperty()`

### currentTimeProperty

public final ReadOnlyObjectProperty<Duration> currentTimeProperty()
Defines the `Animation`'s play head position.

Default value:
  0ms
Returns:
  the `currentTime` property
See Also:
  - `getCurrentTime()`

### setDelay

public final void setDelay(Duration value)
Sets the value of the `delay` property.

Property description:
  Delays the start of an animation. Cannot be negative. Setting to a negative number will result in `IllegalArgumentException`.
Default value:
  0ms
Parameters:
  `value` - the value for the `delay` property
See Also:
  - `getDelay()`
  - `delayProperty()`

### getDelay

public final Duration getDelay()
Gets the value of the `delay` property.

Property description:
  Delays the start of an animation. Cannot be negative. Setting to a negative number will result in `IllegalArgumentException`.
Default value:
  0ms
Returns:
  the value of the `delay` property
See Also:
  - `setDelay(Duration)`
  - `delayProperty()`

### delayProperty

public final ObjectProperty<Duration> delayProperty()
Delays the start of an animation. Cannot be negative. Setting to a negative number will result in `IllegalArgumentException`.

Default value:
  0ms
Returns:
  the `delay` property
See Also:
  - `getDelay()`
  - `setDelay(Duration)`

### setCycleCount

public final void setCycleCount(int value)
Sets the value of the `cycleCount` property.

Property description:
  Defines the number of cycles in this animation. The `cycleCount` may be `INDEFINITE` for animations that repeat indefinitely, but must otherwise be > 0.

  It is not possible to change the `cycleCount` of a running `Animation`. If the value of `cycleCount` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.

Default value:
  1.0
Parameters:
  `value` - the value for the `cycleCount` property
See Also:
  - `getCycleCount()`
  - `cycleCountProperty()`

### getCycleCount

public final int getCycleCount()
Gets the value of the `cycleCount` property.

Property description:
  Defines the number of cycles in this animation. The `cycleCount` may be `INDEFINITE` for animations that repeat indefinitely, but must otherwise be > 0.

  It is not possible to change the `cycleCount` of a running `Animation`. If the value of `cycleCount` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.

Default value:
  1.0
Returns:
  the value of the `cycleCount` property
See Also:
  - `setCycleCount(int)`
  - `cycleCountProperty()`

### cycleCountProperty

public final IntegerProperty cycleCountProperty()
Defines the number of cycles in this animation. The `cycleCount` may be `INDEFINITE` for animations that repeat indefinitely, but must otherwise be > 0.

It is not possible to change the `cycleCount` of a running `Animation`. If the value of `cycleCount` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.

Default value:
  1.0
Returns:
  the `cycleCount` property
See Also:
  - `getCycleCount()`
  - `setCycleCount(int)`

### setAutoReverse

public final void setAutoReverse(boolean value)
Sets the value of the `autoReverse` property.

Property description:
  Defines whether this `Animation` reverses direction on alternating cycles. If `true`, the `Animation` will proceed forward on the first cycle, then reverses on the second cycle, and so on. Otherwise, animation will loop such that each cycle proceeds forward from the start. It is not possible to change the `autoReverse` flag of a running `Animation`. If the value of `autoReverse` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.
Default value:
  false
Parameters:
  `value` - the value for the `autoReverse` property
See Also:
  - `isAutoReverse()`
  - `autoReverseProperty()`

### isAutoReverse

public final boolean isAutoReverse()
Gets the value of the `autoReverse` property.

Property description:
  Defines whether this `Animation` reverses direction on alternating cycles. If `true`, the `Animation` will proceed forward on the first cycle, then reverses on the second cycle, and so on. Otherwise, animation will loop such that each cycle proceeds forward from the start. It is not possible to change the `autoReverse` flag of a running `Animation`. If the value of `autoReverse` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.
Default value:
  false
Returns:
  the value of the `autoReverse` property
See Also:
  - `setAutoReverse(boolean)`
  - `autoReverseProperty()`

### autoReverseProperty

public final BooleanProperty autoReverseProperty()
Defines whether this `Animation` reverses direction on alternating cycles. If `true`, the `Animation` will proceed forward on the first cycle, then reverses on the second cycle, and so on. Otherwise, animation will loop such that each cycle proceeds forward from the start. It is not possible to change the `autoReverse` flag of a running `Animation`. If the value of `autoReverse` is changed for a running `Animation`, the animation has to be stopped and started again to pick up the new value.

Default value:
  false
Returns:
  the `autoReverse` property
See Also:
  - `isAutoReverse()`
  - `setAutoReverse(boolean)`

### setStatus

protected final void setStatus(Animation.Status value)
Sets the value of the `status` property.

Property description:
  The status of the `Animation`. In `Animation` can be in one of three states: `Animation.Status.STOPPED`, `Animation.Status.PAUSED` or `Animation.Status.RUNNING`.
Parameters:
  `value` - the value for the `status` property
See Also:
  - `getStatus()`
  - `statusProperty()`

### getStatus

public final Animation.Status getStatus()
Gets the value of the `status` property.

Property description:
  The status of the `Animation`. In `Animation` can be in one of three states: `Animation.Status.STOPPED`, `Animation.Status.PAUSED` or `Animation.Status.RUNNING`.
Returns:
  the value of the `status` property
See Also:
  - `setStatus(Animation.Status)`
  - `statusProperty()`

### statusProperty

public final ReadOnlyObjectProperty<Animation.Status> statusProperty()
The status of the `Animation`. In `Animation` can be in one of three states: `Animation.Status.STOPPED`, `Animation.Status.PAUSED` or `Animation.Status.RUNNING`.

Returns:
  the `status` property
See Also:
  - `getStatus()`
  - `setStatus(Animation.Status)`

### getTargetFramerate

public final double getTargetFramerate()
The target framerate is the maximum framerate at which this `Animation` will run, in frames per second. This can be used, for example, to keep particularly complex `Animations` from over-consuming system resources. By default, an `Animation`'s framerate is not explicitly limited, meaning the `Animation` will run at an optimal framerate for the underlying platform.

Returns:
  the target framerate

### setOnFinished

public final void setOnFinished(EventHandler<ActionEvent> value)
Sets the value of the `onFinished` property.

Property description:
  The action to be executed at the conclusion of this `Animation`.
Default value:
  null
Parameters:
  `value` - the value for the `onFinished` property
See Also:
  - `getOnFinished()`
  - `onFinishedProperty()`

### getOnFinished

public final EventHandler<ActionEvent> getOnFinished()
Gets the value of the `onFinished` property.

Property description:
  The action to be executed at the conclusion of this `Animation`.
Default value:
  null
Returns:
  the value of the `onFinished` property
See Also:
  - `setOnFinished(EventHandler)`
  - `onFinishedProperty()`

### onFinishedProperty

public final ObjectProperty<EventHandler<ActionEvent>> onFinishedProperty()
The action to be executed at the conclusion of this `Animation`.

Default value:
  null
Returns:
  the `onFinished` property
See Also:
  - `getOnFinished()`
  - `setOnFinished(EventHandler)`

### getCuePoints

public final ObservableMap<String,Duration> getCuePoints()
The cue points can be used to mark important positions of the `Animation`. Once a cue point was defined, it can be used as an argument of `jumpTo()` and `playFrom()` to move to the associated position quickly.

Every `Animation` has two predefined cue points `"start"` and `"end"`, which are set at the start respectively the end of the `Animation`. The predefined cuepoints do not appear in the map, attempts to override them have no effect.

Another option to define a cue point in a `Animation` is to set the `name` property of a `KeyFrame`.

Returns:
  `ObservableMap` of cue points

### jumpTo

public void jumpTo(Duration time)
Jumps to a given position in this `Animation`. If the given time is less than `Duration.ZERO`, this method will jump to the start of the animation. If the given time is larger than the duration of this `Animation`, this method will jump to the end.

Parameters:
  `time` - the new position
Throws:
  `NullPointerException` - if `time` is `null`
  `IllegalArgumentException` - if `time` is `Duration.UNKNOWN`
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`

### jumpTo

public void jumpTo(String cuePoint)
Jumps to a predefined position in this `Animation`. This method looks for an entry in cue points and jumps to the associated position, if it finds one.

If the cue point is behind the end of this `Animation`, calling `jumpTo` will result in a jump to the end. If the cue point has a negative `Duration` it will result in a jump to the beginning. If the cue point has a value of `Duration.UNKNOWN` calling `jumpTo` will have no effect for this cue point.

There are two predefined cue points `"start"` and `"end"` which are defined to be at the start respectively the end of this `Animation`.

Parameters:
  `cuePoint` - the name of the cue point
Throws:
  `NullPointerException` - if `cuePoint` is `null`
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`
See Also:
  - `getCuePoints()`

### playFrom

public void playFrom(String cuePoint)
A convenience method to play this `Animation` from a predefined position. The position has to be predefined in cue points. Calling this method is equivalent to

     animation.jumpTo(cuePoint);
     animation.play();

Note that unlike `playFromStart()` calling this method will not change the playing direction of this `Animation`.

Parameters:
  `cuePoint` - name of the cue point
Throws:
  `NullPointerException` - if `cuePoint` is `null`
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`
See Also:
  - `getCuePoints()`

### playFrom

public void playFrom(Duration time)
A convenience method to play this `Animation` from a specific position. Calling this method is equivalent to

     animation.jumpTo(time);
     animation.play();

Note that unlike `playFromStart()` calling this method will not change the playing direction of this `Animation`.

Parameters:
  `time` - position where to play from
Throws:
  `NullPointerException` - if `time` is `null`
  `IllegalArgumentException` - if `time` is `Duration.UNKNOWN`
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`

### play

public void play()
Plays `Animation` from current position in the direction indicated by `rate`. If the `Animation` is running, it has no effect.

When `rate` > 0 (forward play), if an `Animation` is already positioned at the end, the first cycle will not be played, it is considered to have already finished. This also applies to a backward ( `rate` < 0) cycle if an `Animation` is positioned at the beginning. However, if the `Animation` has `cycleCount` > 1, following cycle(s) will be played as usual.

When the `Animation` reaches the end, the `Animation` is stopped and the play head remains at the end.

To play an `Animation` backwards from the end:
`animation.setRate(negative rate);
animation.jumpTo(overall duration of animation);
animation.play();
`

Note:

- `play()` is an asynchronous call, the `Animation` may not start immediately.

Throws:
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`

### playFromStart

public void playFromStart()
Plays an `Animation` from initial position in forward direction.

It is equivalent to

`animation.stop();
animation.setRate = setRate(Math.abs(animation.getRate()));
animation.jumpTo(Duration.ZERO);
animation.play();
`

Note:

- `playFromStart()` is an asynchronous call, `Animation` may not start immediately.

Throws:
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`

### stop

public void stop()
Stops the animation and resets the play head to its initial position. If the animation is not currently running, this method has no effect.

Note:

- `stop()` is an asynchronous call, the `Animation` may not stop immediately.

Throws:
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`

### pause

public void pause()
Pauses the animation. If the animation is not currently running, this method has no effect.

Note:

- `pause()` is an asynchronous call, the `Animation` may not pause immediately.

Throws:
  `IllegalStateException` - if embedded in another animation, such as `SequentialTransition` or `ParallelTransition`