JavaFX supports a lot of transition and animation classes for Node properties like the javafx.animation.ScaleTransition. But sometimes you need a special animation for that no default transition is provided by JavaFX. Currently the best pratice is to extend javafx.animation.Transitionand override the interpolate(double frac) method:

protected void interpolate(double frac) {

Because JavaFX offers PropertyBinding I created a BindableTransition which current fraction is a Property and can be bind to any other NumberProperty. Here is an example:

Button button = new Button("BindableTransition");
DropShadow shadow = DropShadowBuilder.create().build();

final Duration duration = Duration.millis(1200);
BindableTransition transition = new BindableTransition(duration);


The fractionProperty of the BindableTransition is bound to three different Properties and the result will look like this:

The BindableTransition class and a demo are commited to the JFXtras project.

2 Responses to BindableTransition

  1. This is logic solution. Why this simple enhancment (bindable frac) is not already part of abstract class Transition?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>