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

Profile: desktop, common

Overview

This Transition creates a move/translate animation that spans its duration. This is done by updating the translateX and translateY variables of the node at regular interval.

It starts from the (fromX, fromY) value if provided else uses the node's (translateX, translateY) value.

It stops at the (toX, toY) value if provided else it will use start value plus (byX, byY) value.

The (toX, toY) value takes precedence if both (toX, toY) and (byX, byY) values are specified.

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 transTransition = TranslateTransition {
        duration: 2s node: node
        byX: 200 repeatCount:4 autoReverse: true
    }
    transTransition.play();

...

 

Profile: common

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicbyXNumberTransition.UNDEFINED

Specifies the incremented stop X coordinate value, from the start, of this Transition.

publicbyYNumberTransition.UNDEFINED

Specifies the incremented stop Y coordinate value, from the start, of this Transition.

publicfromXNumberTransition.UNDEFINED

Specifies the start X coordinate value of this Transition.

publicfromYNumberTransition.UNDEFINED

Specifies the start Y coordinate value of this Transition.

publictoXNumberTransition.UNDEFINED

Specifies the stop X coordinate value of this Transition.

publictoYNumberTransition.UNDEFINED

Specifies the stop Y coordinate value of this Transition.

Inherited Variables

javafx.animation.transition.Transition

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicactionfunction():Voidnull

The action to be executed at the end of this duration.

publicautoReverseBooleanfalse

Defines whether this Transition reverses direction on alternating cycles.

Defines whether this Transition reverses direction on alternating cycles. If true, the transition will proceed forward on the first cycle, then reverses on the second cycle, and so on. The default value is false, indicating that the transition will loop such that each cycle proceeds forward from the initial KeyFrame.

false

Profile: common

 
public-readcurrentRateNumber

Defines the current direction/rate at which the transition is being played.

Defines the current direction/rate at which the transition is being played. Rate 1.0 is normal play, and -1.0 is backwards.

Profile: common

 
publicdurationDuration0

The length of this Transition, in milliseconds.

The length of this Transition, in milliseconds. This may only be changed prior to starting the transition or after the transition has ended.

0

Profile: common

 
publicinterpolateInterpolatorEASEBOTH

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

 
public-readpausedBoolean

Read-only var that indicates whether this Transition is currently paused.

Read-only var that indicates whether this Transition is currently paused.

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

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

Profile: common

 
publicrateNumber1.0

Defines the direction/rate at which the transition is being played.

Defines the direction/rate at which the transition is being played. Rate 1.0 is normal play, and -1.0 is backwards.

1.0

Profile: common

 
publicrepeatCountNumber1.0

Defines the number of cycles in this transition.

Defines the number of cycles in this transition. The repeatCount may be INDEFINITE for transition that repeat indefinitely, but must otherwise be >= 0. The default value is 1.

1.0

Profile: common

 
public-readrunningBoolean

Read-only var that indicates whether this Transition is currently running.

Read-only var that indicates whether this Transition is currently running.

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

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

Profile: common

 
publictimeDuration0

Defines the reference elapsed time offset within the Timeline.

Defines the reference elapsed time offset within the Timeline. If timeline is running, it jumps to this time position immediately. If not running, then it will set the current time position to this value and start from here next time play() is called.

0

Profile: common

 
protectedtimelineTimelinesubclasssubclasssubclass

An internal Timeline that get created at the creation of this Transition.

An internal Timeline that get created at the creation of this Transition. It is used to control to the transition operations, such as play() and pause().

Profile: common

 
protectedtimelineDirtyBooleansubclasssubclasssubclasstrue

A Boolean value to indicate, to the subclass, its internal timeline need to be rebuilt.

A Boolean value to indicate, to the subclass, its internal timeline need to be rebuilt. It is the subclass responsibility to set this value to false once the timeline is rebuilt.

true

Profile: common

 
protectedUNDEFINEDNumbersubclass

A Number value which do not map to a valid value for use in animation of node.

A Number value which do not map to a valid value for use in animation of node. This value is used to indicate a Number variable is not initialized or manipulated by a user program.

 

Function Summary

public play() : Void

Starts or resumes this Transition.

Starts or resumes this Transition. It is a no-op if already running. See Timeline#play() for details.

Profile: common

 
public playFromStart() : Void

A convenient function.

A convenient function. It plays this Transition from initial position in forward direction. See Timeline#playFromStart() for details.

Profile: common

 

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

 
public pause() : Void

Pauses this Transition.

Pauses this Transition. If the transition is not currently running, this method has no effect. See Timeline#pause() for details.

Profile: common

 
public play() : Void

Starts or resumes this Transition.

Starts or resumes this Transition. It is a no-op if already running. See Timeline#play() for details.

Profile: common

 
public playFromStart() : Void

A convenient function.

A convenient function. It plays this Transition from initial position in forward direction. See Timeline#playFromStart() for details.

Profile: common

 
public stop() : Void

Stops this Transition and resets its playhead to initial position.

Stops this Transition and resets its playhead to initial position. See Timeline#stop() for details.

Profile: common