viewtify

viewtify.ui.anime

Anime

The Anime class provides a fluent API for defining and running animations in JavaFX. Animations can be applied to various properties of UI elements, such as opacity, background color, and location.

Usage example:


 Anime.define()
     .duration(0.5) // Set default animation duration
     .interpolator(Interpolator.EASE_OUT) // Set default interpolation
     .opacity(nodeProvider, 0.0) // Animate opacity of a node
     .backgroundColor(regionProvider, Color.RED) // Animate background color of a region
     .moveX(nodeProvider, 100) // Animate horizontal movement of a node
     .then(() -> System.out.println("Animation completed"))
     .run();
 

The class supports chaining of animation effects and provides shorthands for common animation scenarios.

Key concepts:

  • WritableValue: Represents a writable property that can be animated.
  • Interpolator: Defines the rate of change of an animation over time.
  • Duration: Represents the length of an animation.

Animations are defined using a fluent API, and effects are applied to properties using the effect method. The run method is then called to execute the animation.

Animations can also be configured to run infinitely with the runInfinitely method.

The class also provides a set of predefined effects for common animation scenarios, such as changing opacity, background color, and location of UI elements.

Additionally, post-action effects can be registered using the effect method, and subsequent actions can be defined using the then method.

The Anime class is designed to be used in conjunction with JavaFX UI elements and supports smooth and flexible animation creation and execution.

BASE_DURATIONjavafx.util.Duration

The standard effect time.

define()Anime

Anime

Create new Anime.

interpolator(javafx.animation.Interpolatorinterpolator)Anime

javafx.animation.Interpolatorinterpolator
Anime

Chainable API.

Set default interpolation.

duration(doubleduration)Anime

doubleduration
Anime

Chainable API.

Set default duration.

duration(javafx.util.Durationduration)Anime

javafx.util.Durationduration
Anime

Chainable API.

Set default duration.

delay(doubledelay)Anime

doubledelay
Anime

Chainable API.

Set default delay.

delay(javafx.util.Durationdelay)Anime

javafx.util.Durationdelay
Anime

Chainable API.

Set default delay.

init(javafx.beans.value.WritableValueNumbervalue, Numbernum)Anime

javafx.beans.value.WritableValueNumbervalue
Numbernum
Anime

Shorthand to declare animation effect.

init(kiss.WiseRunnableinit)Anime

kiss.WiseRunnableinit
Anime

Shorthand to declare animation effect.

backgroundColor(UserInterfaceProvider?javafx.scene.layout.Regionregion, javafx.scene.paint.Colorcolor)Anime

UserInterfaceProvider?javafx.scene.layout.Regionregion
javafx.scene.paint.Colorcolor
Anime

Animate background color

opacity(UserInterfaceProvider?Nodenode, doublenum)Anime

UserInterfaceProvider?Nodenode
doublenum
Anime

Animate background color

opacity(Nodenode, doublenum)Anime

Nodenode
doublenum
Anime

Animate background color

move(UserInterfaceProvider?Nodenode, doublex, doubley)Anime

UserInterfaceProvider?Nodenode
doublex
doubley
Anime

Animate location.

moveX(Nodenode, doublex)Anime

Nodenode
doublex
Anime

Animate location.

moveX(UserInterfaceProvider?Nodenode, doublex)Anime

UserInterfaceProvider?Nodenode
doublex
Anime

Animate location.

moveY(Nodenode, doubley)Anime

Nodenode
doubley
Anime

Animate location.

moveY(UserInterfaceProvider?Nodenode, doubley)Anime

UserInterfaceProvider?Nodenode
doubley
Anime

Animate location.

effect(javafx.beans.value.WritableValueVvalue, Vnum)Anime

V
javafx.beans.value.WritableValueVvalue

The WritableValue to be animated.

Vnum

The target value for the animation.

Anime

This Anime instance for method chaining.

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableValueVvalue, UnaryOperatorVnum)Anime

V
javafx.beans.value.WritableValueVvalue
UnaryOperatorVnum
Anime

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableIntegerValuevalue, IntUnaryOperatornum)Anime

javafx.beans.value.WritableIntegerValuevalue

The WritableIntegerValue to be animated.

IntUnaryOperatornum

The target value for the animation.

Anime

This Anime instance for method chaining.

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableLongValuevalue, LongUnaryOperatornum)Anime

javafx.beans.value.WritableLongValuevalue

The WritableLongValue to be animated.

LongUnaryOperatornum

The target value for the animation.

Anime

This Anime instance for method chaining.

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableDoubleValuevalue, DoubleUnaryOperatornum)Anime

javafx.beans.value.WritableDoubleValuevalue

The WritableDoubleValue to be animated.

DoubleUnaryOperatornum

The target value for the animation.

Anime

This Anime instance for method chaining.

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableValueVvalue, Vnum, javafx.animation.Interpolatorinterpolator)Anime

V
javafx.beans.value.WritableValueVvalue

The WritableValue to be animated.

Vnum

The target value for the animation.

javafx.animation.Interpolatorinterpolator

The Interpolator for the animation.

Anime

This Anime instance for method chaining.

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableValueVvalue, Vnum, doublesec)Anime

V
javafx.beans.value.WritableValueVvalue
Vnum
doublesec
Anime

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableValueVvalue, Vnum, doublesec, javafx.animation.Interpolatorinterpolator)Anime

V
javafx.beans.value.WritableValueVvalue
Vnum
doublesec
javafx.animation.Interpolatorinterpolator
Anime

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableValueVvalue, Vnum, javafx.util.Durationduration)Anime

V
javafx.beans.value.WritableValueVvalue
Vnum
javafx.util.Durationduration
Anime

Shorthand to declare animation effect.

effect(javafx.beans.value.WritableValueVvalue, Vnum, javafx.util.Durationduration, javafx.animation.Interpolatorinterpolator)Anime

V
javafx.beans.value.WritableValueVvalue
Vnum
javafx.util.Durationduration
javafx.animation.Interpolatorinterpolator
Anime

Shorthand to declare animation effect.

effect(kiss.WiseRunnableeffect)Anime

kiss.WiseRunnableeffect

The post-action effect to be registered.

Anime

This Anime instance for method chaining.

Shorthand to declare animation effect.

then(kiss.WiseRunnablefinisher)Anime

kiss.WiseRunnablefinisher

The actions to be performed after the current animation.

Anime

This Anime instance for method chaining.

Define the next action.

run(kiss.WiseRunnablefinisher)kiss.Disposable

kiss.WiseRunnablefinisher

The actions to be performed after the animation completes.

kiss.Disposable

A Disposable instance that can be used to stop the animation.

Play animation.

runInfinitely()kiss.Disposable

kiss.Disposable

A Disposable instance that can be used to stop the animation loop.

Play animation with loop.