tornadofx / tornadofx / ViewTransition

ViewTransition

abstract class ViewTransition

A class that, when used with replaceWith or UIComponent.replaceWith, allows you to replace Views, Fragments, or Nodes using a transition effect.

To create a new ViewTransition, you need to implement the ViewTransition.create function. You should also override ViewTransition.onComplete to cleanup any changes to the nodes (such as resetting transformations).

During the transition, the view/fragment/node being transitioned is replaced with a temporary StackPane containing both the current node and its replacement. By default, this StackPane contains only these two nodes with the current node on top. You can override ViewTransition.stack to change how this works.

If you need to change the order of the stack during the transition, you have access to the stack as a parameter of the create method, and there is also a StackPane extension function (ViewTransition.moveToTop) for convenience.

Types

Cover class Cover : ReversibleViewTransition<Reveal>

A ReversibleViewTransition where a node slides in in a given direction covering another node.

Direction enum class Direction
Dissolve class Dissolve : ViewTransition

A ViewTransition where a node is dissolved revealing another node.

Explode class Explode : ReversibleViewTransition<Implode>

A ReversibleViewTransition where a node grows and fades out revealing another node.

Fade class Fade : ViewTransition

A ViewTransition that smoothly fades from one node to another.

FadeThrough class FadeThrough : ViewTransition

A ViewTransition that fades from one node to another through a Paint (useful for fading through black).

Flip class Flip : ViewTransition

A ViewTransition similar to flipping a node over to reveal another on its back. The effect has no perspective (it isnt 3D) due to the limits of JavaFXs affine transformation system.

Implode class Implode : ReversibleViewTransition<Explode>

A ReversibleViewTransition where a node shrinks and fades in revealing another node.

Metro class Metro : ReversibleViewTransition<Metro>

A ReversibleViewTransition where a node fades and slides out in a given direction while another node fades and slides in. The effect is similar to effects commonly used in Windows applications (thus the name).

NewsFlash class NewsFlash : ViewTransition

A ViewTransition where a node spins and grows like a newspaper.

Reveal class Reveal : ReversibleViewTransition<Cover>

A ReversibleViewTransition where a node slides out in a given direction revealing another node.

ReversibleViewTransition abstract class ReversibleViewTransition<out T : ViewTransition> : ViewTransition

A ViewTransition that can be reversed

Slide class Slide : ReversibleViewTransition<Slide>

A ReversibleViewTransition that slides one node out (in a given direction) while sliding another in. The effect is similar to panning the camera in the opposite direction.

Swap class Swap : ReversibleViewTransition<Swap>

A ReversibleViewTransition that swaps the two nodes in a way that looks like two cards in a deck being swapped.

Wipe class Wipe : ReversibleViewTransition<Wipe>

A ReversibleViewTransition where a node is wiped away in a given direction revealing another node.

Constructors

<init> ViewTransition()

A class that, when used with replaceWith or UIComponent.replaceWith, allows you to replace Views, Fragments, or Nodes using a transition effect.

Properties

setup var setup: StackPane.() -> Unit

Functions

create abstract fun create(current: Node, replacement: Node, stack: StackPane): Animation

Create an animation to play for the transition between two nodes. The StackPane used as a placeholder during the transition is also provided.

moveToTop fun StackPane.moveToTop(node: Node): Unit

If the given node exists in this StackPane, move it to be on top (visually).

onComplete open fun onComplete(removed: Node, replacement: Node): Unit

Will be called after the transition is finished and the replacement node has been docked. This function is useful for resetting changes made to the node during the transition, such as position, scale, and opacity.

setup fun setup(setup: StackPane.() -> Unit): Unit

This allows users to modify the generated stack after the the ViewTransition is generated (so they can add things like AnchorPane and VGrow/HGrow constraints).

stack open fun stack(current: Node, replacement: Node): StackPane

Create a StackPane in which the transition will take place. You should generally put both the current and the replacement nodes in the stack, but it isnt technically required.

toCanvas fun Image.toCanvas(): <ERROR CLASS>

Companion Object Properties

SlideIn val SlideIn: (UIComponent, UIComponent, () -> Unit) -> Unit
SlideOut val SlideOut: (UIComponent, UIComponent, () -> Unit) -> Unit

Extension Functions

getProperty fun <T> Any.getProperty(prop: KMutableProperty1<*, T>): ObjectProperty<T>
observable fun <T : Any> Any.observable(propName: String): ObjectProperty<T>

Inheritors

Dissolve class Dissolve : ViewTransition

A ViewTransition where a node is dissolved revealing another node.

Fade class Fade : ViewTransition

A ViewTransition that smoothly fades from one node to another.

FadeThrough class FadeThrough : ViewTransition

A ViewTransition that fades from one node to another through a Paint (useful for fading through black).

Flip class Flip : ViewTransition

A ViewTransition similar to flipping a node over to reveal another on its back. The effect has no perspective (it isnt 3D) due to the limits of JavaFXs affine transformation system.

NewsFlash class NewsFlash : ViewTransition

A ViewTransition where a node spins and grows like a newspaper.

ReversibleViewTransition abstract class ReversibleViewTransition<out T : ViewTransition> : ViewTransition

A ViewTransition that can be reversed