JavaFX supports animations using the tools in the `javafx.animation`
package, but it lacks an easy way of defining animations in
stylesheets. This feature has often been requested, but is still
missing [0] [1] [2].

While there are several ways to tackle this problem (an alternative
notation is presented in [2]), I think the best approach is to
implement CSS Transitions [3] for JavaFX. CSS Transitions is an
established and stable specification, and it is ubiquitous all over
the web.

I've prepared a PR that illustrates how that feature can look like in JavaFX:
https://github.com/openjdk/jfx/pull/870

With this PR, JavaFX would support animated transitions for all
numeric and `Interpolatable` styleable properties.

However, in order to support transitions for CSS sub-properties like
`-fx-background-color`, several background-related types must be made
interpolatable as well (the same is true for border-related types).

If this proposal goes forward, I plan to deliver the feature in two
installments:
1. CSS Transitions (the above PR)
2. Interpolation support for `Background`, `BackgroundFill`,
`CornerRadii`, `Insets`, `Border`, `BorderWidths` and `Margins`

I'm looking foward for comments and feedback.


[0] https://bugs.openjdk.org/browse/JDK-8283676
[1] https://bugs.openjdk.org/browse/JDK-8092084
[2] https://bugs.openjdk.org/browse/JDK-8090892
[3] https://www.w3.org/TR/css-transitions-1/

Reply via email to