RFR: 8332895: Support interpolation for backgrounds and borders
Florian Kirmaier
fkirmaier at openjdk.org
Tue Jun 4 16:31:59 UTC 2024
On Sun, 2 Jun 2024 18:50:20 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
> This PR completes the CSS Transitions story (see #870) by adding interpolation support for backgrounds and borders, making them targetable by transitions.
>
> `Background` and `Border` objects are deeply immutable, but not interpolatable. Consider the following `Background`, which describes the background of a `Region`:
>
>
> Background {
> fills = [
> BackgroundFill {
> fill = Color.RED
> }
> ]
> }
>
>
> Since backgrounds are deeply immutable, changing the region's background to another color requires the construction of a new `Background`, containing a new `BackgroundFill`, containing the new `Color`.
>
> Animating the background color using a CSS transition therefore requires the entire Background object graph to be interpolatable in order to generate intermediate backgrounds.
>
> More specifically, the following types will now implement `Interpolatable`.
>
> - `Insets`
> - `Background`
> - `BackgroundFill`
> - `BackgroundImage`
> - `BackgroundPosition`
> - `BackgroundSize`
> - `Border`
> - `BorderImage`
> - `BorderStroke`
> - `BorderWidths`
> - `CornerRadii`
> - `ImagePattern`
> - `LinearGradient`
> - `RadialGradient`
> - `Stop`
>
> Note that this PR also changes the specification of `Interpolatable` to make users aware that they shouldn't assume any particular identity of the object returned from the `interpolate()` method. This allows the implementation to re-use objects and reduce the number of object allocations.
Ok, great! Thank you for the feedback.
I feared some magic was happening, but based on your response, this looks good!
As far as I understand this, this is just command sense and, in my opinion, doesn't have to be documented.
It's somewhat confusing and irrelevant.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1471#issuecomment-2147504885
More information about the openjfx-dev
mailing list