- Added
AnimatedSlider
, aSlider
implementation that dynamically animates its value. - Added animation callbacks (#6)
Callbacks
Animation callbacks were added to:
AnimationProperty
- Presets
AnimatedValue
, includingAnimatedValueLabel
Animation
transition
The callback for Animation
(used for AnimateFX-based features, such as switchers and animated containers) is extremely simple:
Animation animation = new Animation(new FadeIn());
animation.setOnFinished(e -> ...);
For the sake of usability, a fluent setter was also added:
Animation animation = new Animation(new FadeIn()).onFinished(e -> ...);
binding
The implementation for the binding
package is slightly different: the classes listed previously now feature setOnAnimationStarted
and setOnAnimationEnded
.
AnimationProperty<Double> property = AnimationProperty.of(someProperty());
property.setOnAnimationStarted(e -> ...);
property.setOnAnimationEnded(e -> ...);
They handle AnimationEvent
s that can be affected by interruptions.
From the AnimationEvent#isInterrupted()
documentation:
- If this event represents the end of an animation, the interrupted status means the animation stopped before the expected time because the wrapped value was externally changed and a new animation has to be played.
- If this event represents the start of an animation, the interrupted status means the animation started right after an interrupted end animation.
property.setOnAnimationEnded(e -> {
if (e.isInterrupted()) {
System.out.println("The animation was interrupted, a new one will play now");
}
})
A fluent setter is available here too:
Animated animated = new Animated(node,
new AnimatedOpacity()
.onAnimationEnded(e -> ...)
)
AnimationProperty.of(someProperty()).onAnimationStarted(e -> ...).register();
AnimatedValueLabel<Double> label = new AnimatedValueLabel<>(0.0)
.onAnimationStarted(e -> ...)
.onAnimationEnded(e -> ...);