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) {
myProperty.set(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();
button.setEffect(shadow);
final Duration duration = Duration.millis(1200);
BindableTransition transition = new BindableTransition(duration);
transition.setCycleCount(1000);
transition.setAutoReverse(true);
shadow.offsetXProperty().bind(transition.fractionProperty().multiply(32));
shadow.offsetYProperty().bind(transition.fractionProperty().multiply(32));
button.translateXProperty().bind(transition.fractionProperty().multiply(-32));
transition.play();
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.

[...] Ebbers has blogged about his BindableTransition class and invokeAndWait method that he has made available to [...]
This is logic solution. Why this simple enhancment (bindable frac) is not already part of abstract class Transition?