CSS Transitions
Michael Strauß
michaelstrau2 at gmail.com
Wed Jul 12 01:13:06 UTC 2023
My comments inline:
On Tue, Jul 11, 2023 at 11:28 PM John Hendrikx <john.hendrikx at gmail.com> wrote:
>
> Should this also provide fx-ease-in (etc) if you want to be compatible
> with other FX animations instead of CSS ones (which have little meaning
> in FX apps) ?
Yes, I think that's a good idea.
> > Note that step-wise interpolators are only available for CSS
> > Transitions, they are not exposed as new public API in the
> > `javafx.animation` framework. The reason for this is that step-wise
> > interpolators accept negative input values and can produce different
> > results depending on their `step-position` parameter (for details on
> > that, see "2.3.1. Output of a step easing function" [5]).
>
> I would think that an Interpolator still has a defined begin and end
> state, regardless if it is step based or a smooth transition. Perhaps
> I'm misunderstanding something here about the step based transitions,
> but I don't see why the fraction value running from 0 to 1 would be
> incompatible with step based transitions. The following interpolator
> would create 10 discrete steps:
>
> new Interpolator() {
> @Override
> protected double curve(double t) {
> return Math.floor(t * 10) / 10; // 10 steps
> }
> };
>
> Add some parameters, and make adjustments for the various CSS jump
> types, whether ceil/floor should be used, etc, and I think it could
> implement the CSS step variants as well.
I think you're right. In general, the distinction is relevant when we
are in the delay phase before the active phase and the animated value
is back-filled into the delay phase.
However, a closer reading of the specification reveals that a CSS
transition is not back-filling (which I thought it was). The
specification states:
"If the current time is at or before the start time of the transition
(that is, during the delay phase of the transition), the current value
is a specified style that will compute to the start value of the
transition."
https://www.w3.org/TR/css-transitions-1/#application
The start value of the transition is the value of the property before
it was affected by the transition. In other words, the transition does
not back-fill the first value of the active phase into the delay
phase.
If we end up implementing CSS Animations, or if we enhance JavaFX
animations to support different fill modes, we would need to change
the specification of interpolators to accept negative values, or add a
side channel to pass in the "before-active" information.
More information about the openjfx-dev
mailing list