TransitionTimer is the base class for timers that compute intermediate
values for implicit transitions of a StyleableProperty.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | TransitionTimer.
A token that can be used to cancel a running timer. |
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private long | |
| private long | |
| private long | |
| private final Interpolator | |
| private final TransitionMediator | |
| private double | |
| private boolean | |
| private long | |
| private final Node | |
| private final String |
| Access | Constructor and Description |
|---|---|
| private | TransitionTimer(TransitionMediator mediator, TransitionDefinition definition, String targetPropertyName, long nanoNow)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | adjustReversingTimings(TransitionTimer
the timer of the running transition existingTimer)If a running transition is interrupted by a new transition, we adjust the start time and end time of the new transition with the reversing shortening factor of the old transition. |
| public void | |
| private void | fireTransitionEvent(EventType<TransitionEvent>
the event type eventType)Fires a |
| public TransitionMediator | Returns: theTransitionMediatorReturns the |
| private double | Returns: the input progress, ranging from 0 to 1Gets the progress of this timer along the input progress axis. |
| public void | handle(long
the timestamp of the current frame, in nanoseconds now)Implements abstract javafx. Called once per frame to update the |
| private void | |
| private static long | Returns: the duration in nanosecondsthe duration in fractional milliseconds millis)Converts the specified duration in fractional milliseconds to nanoseconds. |
| private static double | Returns: the duration in fractional millisecondsthe duration in nanoseconds nanos)Converts the specified duration in nanoseconds to fractional milliseconds. |
| public static TransitionTimer. | Returns: aCancellationToken if the timer was started, null otherwisethe mediator, TransitionDefinition TransitionMediator for the targeted propertythe definition, String TransitionDefinition used to initialize the timerthe name of the CSS property targeted by the transition targetPropertyName, long the current time in nanoseconds nanoNow)Starts the specified transition timer with the specified transition definition. |
| public void | start()
Overrides javafx. Starts this timer, and adds it to the list of running transitions. |
| public void | stop()
Overrides javafx. Stops this timer without updating the property to the target value. |
| private void | stopTimer(EventType<TransitionEvent>
the event type that is fired after the timer is stopped eventType)Stops the running timer and fires the specified event. |
| private void | update(double
the input progress value progress)Updates the transition mediator by mapping the specified input progress to an output progress
value using the timer's interpolator, and then calling |
| currentTime | back to summary |
|---|---|
| private long currentTime | |
| delay | back to summary |
|---|---|
| private long delay | |
| duration | back to summary |
|---|---|
| private long duration | |
| endTime | back to summary |
|---|---|
| private long endTime | |
| interpolator | back to summary |
|---|---|
| private final Interpolator interpolator | |
| mediator | back to summary |
|---|---|
| private final TransitionMediator mediator | |
| reversingShorteningFactor | back to summary |
|---|---|
| private double reversingShorteningFactor | |
| started | back to summary |
|---|---|
| private boolean started | |
| startTime | back to summary |
|---|---|
| private long startTime | |
| targetNode | back to summary |
|---|---|
| private final Node targetNode | |
| targetPropertyName | back to summary |
|---|---|
| private final String targetPropertyName | |
| TransitionTimer | back to summary |
|---|---|
| private TransitionTimer(TransitionMediator mediator, TransitionDefinition definition, String targetPropertyName, long nanoNow) | |
| adjustReversingTimings | back to summary |
|---|---|
| private void adjustReversingTimings(TransitionTimer existingTimer) If a running transition is interrupted by a new transition, we adjust the start time and end time of the new transition with the reversing shortening factor of the old transition. Note that the reversing shortening factor is computed in output progress space (value), not in input progress space (time). This algorithm fixes transition asymmetries that can happen when a transition is interrupted by a reverse transition. Consider a linear transition that animates a value over 4s, but is interrupted after 1s. When the transition is interrupted, the value has progressed one quarter of the value space in one quarter of the duration. However, the reverse transition now takes the entire duration (4s) to progress just one quarter of the original value space, which means that the transition speed is much slower than what would be expected.
| |
| complete | back to summary |
|---|---|
| public void complete() Skips the rest of a running transition and updates the property to the target value. This happens when the targeted node is removed from the scene graph or becomes invisible. | |
| fireTransitionEvent | back to summary |
|---|---|
| private void fireTransitionEvent(EventType<TransitionEvent> eventType) Fires a
| |
| getMediator | back to summary |
|---|---|
| public TransitionMediator getMediator() Returns the
| |
| getProgress | back to summary |
|---|---|
| private double getProgress() Gets the progress of this timer along the input progress axis.
| |
| handle | back to summary |
|---|---|
| public void handle(long now) Implements abstract javafx. Called once per frame to update the
This method fires
| |
| interrupt | back to summary |
|---|---|
| private void interrupt() Stops this timer without invoking | |
| millisToNanos | back to summary |
|---|---|
| private static long millisToNanos(double millis) Converts the specified duration in fractional milliseconds to nanoseconds.
| |
| nanosToMillis | back to summary |
|---|---|
| private static double nanosToMillis(long nanos) Converts the specified duration in nanoseconds to fractional milliseconds.
| |
| run | back to summary |
|---|---|
| public static TransitionTimer. Starts the specified transition timer with the specified transition definition.
If the combined duration of the transition is zero or if the targeted node is not
showing, no transition timer is started, no events are dispatched, and this method
returns
| |
| start | back to summary |
|---|---|
| public void start() Overrides javafx. Starts this timer, and adds it to the list of running transitions.
| |
| stop | back to summary |
|---|---|
| public void stop() Overrides javafx. Stops this timer without updating the property to the target value. This happens when the value of the styleable property is changed by the user, or when a running timer is cancelled by a transition with zero duration.
| |
| stopTimer | back to summary |
|---|---|
| private void stopTimer(EventType<TransitionEvent> eventType) Stops the running timer and fires the specified event.
| |
| update | back to summary |
|---|---|
| private void update(double progress) Updates the transition mediator by mapping the specified input progress to an output progress
value using the timer's interpolator, and then calling
| |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| cancel | back to summary |
|---|---|
| public void cancel() | |