RFR: 8332895: Support interpolation for backgrounds and borders [v3]
Michael Strauß
mstrauss at openjdk.org
Sat Aug 3 00:17:39 UTC 2024
On Fri, 2 Aug 2024 21:38:04 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/css/ComponentTransitionable.java line 35:
>>
>>> 33: * Identifies a class that supports component-wise CSS transitions.
>>> 34: * <p>
>>> 35: * Component-wise transitions offer more flexibility than {@link Interpolatable} transitions.
>>
>> Why is the name not `ComponentInterpolatable`?
>
> I see two uses of this interface, both in combination with `Interpolatable`. Should this just extend `Interpolatable`, or are there cases to be expected where this marker is present but `Interpolatable` is not?
>
> Also, have you considered adding a default method to `Interpolatable` to indicate it supports component wise interpolation?
>
> It looks modelled after `RandomAccess`, but the reasons for that being a marker interface are not similar to this situation (it is a marker interface so it can also mark the old collections, like `Vector`).
`ComponentTransitionable` is kind of orthogonal to `Interpolatable`. It tells us to first decompose the object, and then transition each component separately. `Border` and `Background` implement both interfaces, but `Interpolatable` is not used for CSS transitions (i.e. `Border.interpolate()` is not called).
It doesn't make much sense to add a default method to `Interpolatable` to indicate component-wise transitions, because we can't use the `interpolate()` method for component-wise transitions.
This should be thought of as two paths: we either use `Interpolatable`, or we use the decompose-reconstruct route (which is only available to CSS, but not programmatically).
Now, the name might also be `ComponentInterpolatable`, but this suggests a close proximity to `Interpolatable` (being in the `javafx.animation` package, having a programmatic API, etc). However, `ComponentTransitionable` only works for objects that expose their components to CSS (which is why it is located in `javafx.css` and not `javafx.animation`).
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1522#discussion_r1702415097
More information about the openjfx-dev
mailing list