JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

expand all

Profile: desktop, common

Overview

This Transition starts all timelines in its content in sequential order.

content of this Transition inherit node if their node variable is not specified.

duration, repeatCount, and autoReverse variables have no effect on this Transition.

Code Segment Example:


import javafx.scene.shape.*;
import javafx.animation.transition.*;

...

    var node = Rectangle {
        x: 100 y: 40
        height: 100 width:  100
        arcHeight: 50 arcWidth: 50
        fill: Color.VIOLET
    }

    var seqTransition = SequentialTransition {
        node: node
        content: [
            PauseTransition { duration: 1s },  // wait a second
            FadeTransition { duration: 3s fromValue: 1.0 toValue: 0.3 
                repeatCount:4 autoReverse: true},
            TranslateTransition { duration: 2s byX: -100 repeatCount:2 autoReverse: true},    
            TranslateTransition { duration: 2s byX: 100 repeatCount:2 autoReverse: true},
            RotateTransition { duration: 3s byAngle: 180
                repeatCount:4 autoReverse: true},
            ScaleTransition { duration: 2s node: node byX: 1.5 byY: 1.5 
                repeatCount:2 autoReverse: true},
        ]
    }
    seqTransition.play();

...

Profile: common

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publiccontentTimeline[]

A sequence of Timeliness that will be triggered in order whenever this Transition is triggered.

Inherited Variables

javafx.animation.transition.Transition

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicactionfunction():Voidnull

The action to be executed at the conclusion of this Transition.

publicinterpolatorInterpolatorEASEBOTH

Controls the timing for acceleration and deceleration at each transition cycle.

Controls the timing for acceleration and deceleration at each transition cycle. This may only be changed prior to starting the transition or after the transition has ended. If changed during a transition then the change will not take effect until the next transition.

Default interpolator is set to Interpolator#EASEBOTH.

EASEBOTH

Profile: common

 
publicnodeNodenull

The target node of this Transition.

protectedparentTransitionsubclasssubclasssubclassnull

The parent of this Transition.

The parent of this Transition. If this transition has not been added to another transition, such as ParallelTransition and SequentialTransition, then parent will be null.

null

Profile: common

 

javafx.animation.Timeline

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicautoReverseBooleanfalse

Defines whether this animation reverses direction on alternating cycles.

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 initial KeyFrame.

false

Profile: common

 
public-readcurrentRateNumber0.0

Read-only variable to indicate current direction/speed at which the Timeline is being played.

Read-only variable to indicate current direction/speed at which the Timeline 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

0.0

Profile: common

 
public-read protectedcycleDurationDurationsubclasssubclass0ms

Read-only variable to indicate the duration of one cycle of this Timeline: the time it takes to play from time 0 to the KeyFrame with the largest time (at the default rate of 1.0).

Read-only variable to indicate the duration of one cycle of this Timeline: the time it takes to play from time 0 to the KeyFrame with the largest time (at the default rate of 1.0).

This is set to the largest time value of its keyFrames.

0ms

Profile: common

 
public-initframerateNumber

The maximum framerate at which this animation will run, in frames per second.

The maximum framerate at which this animation will run, in frames per second. This can be used, for example, to keep particularly complex Timelines from over-consuming system resources. By default, a Timeline's framerate is not explicitly limited, meaning the Timeline will run at an optimal framerate for the underlying platform.

Profile: common

 
publicinterpolateBooleantrue

Enable/disable interpolation.

publickeyFramesKeyFrame[]

Defines the sequence of KeyFrames in this animation.

Defines the sequence of KeyFrames in this animation. KeyFrames are expected to have time >= 0s, otherwise they will be ignored. If a KeyFrame is not provided for the time==0s instant, one will be synthesized using the target values that are current at the time play() or playFromStart() is called.

See Also:
KeyFrame#time

Profile: common

 
public-readpausedBoolean

Read-only var that indicates whether the animation is currently paused.

Read-only var that indicates whether the animation is currently paused.

This value is initially false. It will become true after pause() has been called on a running animation, and then becomes false again after an explicit call to resume() or stop().

Note that running will remain true even when paused==true.

Profile: common

 
publicrateNumber1.0

Defines the direction/speed at which the Timeline is expected to be played.

Defines the direction/speed at which the Timeline is expected to be played.

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

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

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

1.0

Profile: common

 
publicrepeatCountNumber1.0

Defines the number of cycles in this animation.

Defines the number of cycles in this animation. The repeatCount may be INDEFINITE for animations that repeat indefinitely, but must otherwise be >= 0.

1.0

Profile: common

 
public-readrunningBoolean

Read-only var that indicates whether the animation is currently running.

Read-only var that indicates whether the animation is currently running.

This value is initially false. It becomes true after play() or playFromStart() has been called, and then becomes false again after the animation ends naturally, or after an explicit call to stop().

If running is true, any change to time will result to immediate update of all target variables accordingly. Otherwise, if running is false, changes made to time will not affect target variables.

Note that running will remain true even when paused==true.

Profile: common

 
publictimeDuration0ms

Defines the Timeline's play head position.

Defines the Timeline's play head position.

If Timeline is running, it jumps to the specified position immediately. If it is not running, the time indicates from where the Timeline to start when next play() is called.

If user wants to bind the variable and update it simultaneously, bidirectional bind is needed.

var pos: Duration;
var t: Timeline = Timeline {
time: bind pos with inverse;
...
}

0ms

Profile: common

 
public-readtotalDurationDuration0ms

Read-only variable to indicate the total duration of this Timeline, including repeats.

Read-only variable to indicate the total duration of this Timeline, including repeats. A Timeline with a repeatCount of Timeline.INDEFINITE will have a totalDuration of Duration.INDEFINITE.

This is set to cycleDuration * repeatCount.

0ms

Profile: common

 

Function Summary

public pause() : Void
 
public play() : Void
 
public playFromStart() : Void
 
protected rebuildKeyFrames() : KeyFrame[]
Returns
KeyFrame[]
 
public stop() : Void
 

Inherited Functions

javafx.animation.transition.Transition

protected getTargetNode() : Node

Returns the target Node for animation of this Transition.

Returns the target Node for animation of this Transition. This method returns node if it is set, else returns its parent.getTargetNode() otherwise null.

Returns
Node

Profile: common

 
protected markDirty() : Void

Subclasses invoke this function to mark the Transition as dirty and in need of rebuilding the keyFrames for the transition.

Subclasses invoke this function to mark the Transition as dirty and in need of rebuilding the keyFrames for the transition. This function only marks the state as dirty, a subsequent call to rebuild() is necessary to actually rebuild the keyframes. Generally this is done automatically when an animation is started, but can be forced if semantics require it.

 
public play() : Void

Starts or resumes this Transition.

Starts or resumes this Transition. It is a no-op if already running.

Profile: common

 
public playFromStart() : Void

A convenience function which plays this Transition from the initial position in the forward direction.

A convenience function which plays this Transition from the initial position in the forward direction.

See Timeline#playFromStart() for details.

Profile: common

 
public rebuild() : Void

Rebuilds the keyFrames for this Transition if and only if the transition is dirty and a transition is not currently running (where 'running' includes paused transitions).

Rebuilds the keyFrames for this Transition if and only if the transition is dirty and a transition is not currently running (where 'running' includes paused transitions).

 
protected abstract rebuildKeyFrames() : KeyFrame[]

Builds the keyframes for this transition.

Builds the keyframes for this transition.

Returns
KeyFrame[]
 
public stop() : Void

Stops the Transition and then marks it dirty so that on the next run of the transition, it will be rebuilt.

Stops the Transition and then marks it dirty so that on the next run of the transition, it will be rebuilt.

Profile: common

 

javafx.animation.Timeline

public evaluateKeyValues() : Void

Instructs the Timeline to evaluate all KeyValue.value()s in the Timeline.

Instructs the Timeline to evaluate all KeyValue.value()s in the Timeline.

See Also:
KeyFrame.values

Profile: common

 
public pause() : Void

Pauses the animation.

Pauses the animation. If the animation is not currently running, this method has no effect.

Note:

  • pause() is an asynchronous call, timeline may not pause immediately.

    Profile: common

     
  • public play() : Void

    Plays Timeline from current position in the direction indicated by rate.

    Plays Timeline from current position in the direction indicated by rate. If the timeline is running, it has no effect.

    When rate > 0 (forward play), if a Timeline 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 a timeline is positioned at the beginning. However, if the Timeline has repeatCount > 1, following cycle(s) will be played as usual.

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

    To play a Timeline backwards from the end:
    timeline.rate = negative rate
    timeline.time = overall duration of timeline
    timeline.play()

    Note:

  • play() is an asynchronous call, Timeline may not start immediately.

    Profile: common

     
  • public playFromStart() : Void

    Plays timeline from initial position in forward direction.

    Plays timeline from initial position in forward direction.

    It is equivalent to

    timeline.stop();
    timeline.rate = Math.abs(timeline.rate);
    timeline.time = 0.0s;
    timeline.play();

    Note:

  • playFromStart() is an asynchronous call, Timeline may not start immediately.

    Profile: common

     
  • public stop() : Void

    Stops the animation and resets the play head to its initial position.

    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, timeline may not stop immediately.

    Profile: common