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

Profile: desktop, common

Overview

This Transition creates a path animation that spans its duration. The translation along the path is done by updating the translateX and translateY variables of the node, and the rotate variable will get updated if orientation is set to OrientationType.ORTHOGONAL_TO_TANGENT, at regular interval.

The animated path is defined by the opaque geometric path created by one of the AnimationPath#createFromPath functions.

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 path = Path {
        elements: [
            MoveTo { x: positionX y: positionY }, 
            CubicCurveTo {
                controlX1:  40     controlY1:  10
                controlX2: 390     controlY2: 240
                x: 190             y:  50
            }
        ]
        stroke:Color.WHITE
    }

    var pathTransition = PathTransition {
        duration: 10s node: node 
        path: AnimationPath.createFromPath(path)
        orientation: OrientationType.ORTHOGONAL_TO_TANGENT 
        repeatCount:4 autoReverse: true
    }
    pathTransition.play();

...

Profile: common

Variable Summary

accessnametypeCan ReadCan InitCan WriteDefault Valuedescription
publicdurationDuration400ms

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. If changed during a transition then the change will not take effect until the next transition.

400ms

Profile: common

 
publicorientationOrientationTypeNONE

Specifies the upright orientation of node along the path.

Specifies the upright orientation of node along the path. The default orientation is set to OrientationType#NONE.

NONE

Profile: common

 
publicpathAnimationPathnull

An opaque geometric path generated from one of the createFromPath functions of the AnimationPath class.

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

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 will become true after start() has been called, and then becomes false again after the animation ends naturally, or after an explicit call to stop().

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

protected rebuildKeyFrames() : java.lang.Object[]
Returns
Object[]
 

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() : Boolean

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.

Returns
Boolean
 
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() : java.lang.Object[]

Builds the keyframes for this transition.

Builds the keyframes for this transition.

Returns
Object[]
 
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 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

    &nbsp;
  • 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

    &nbsp;
  • 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

    &nbsp;



  • Spec-Zone.ru - all specs in one place