Re: [csswg-drafts] [web-animations-1] Alternative to FillAnimation: replace events (#3689)

I'm going to try and document the alternative proposal we discussed at the meeting yesterday, but first, one thing I recalled after our meeting was that even if we change the order of operation for the effect stack so that interpolation happens before addition, I don't think it will drastically simplify implementation or improve performance of any `FillAnimation`-like solution.

Consider lengths and percentages. For some properties it is possible to interpolate from `5em` to `20%`, for example. The promise of `FillAnimation` is that it makes the substitution unobservable (at least from the point of view of the output style). Therefore it needs to preserve the context-sensitive behavior of these units.

The simplest way to do that is simply to preserve the interpolation interval endpoint(s) (there will be two endpoints if the animation fills mid-interval, one otherwise). For a stack using addition, this simple approach involves preserving the interval endpoint(s) for the whole additive part of the stack.

If that proves undesirable, a UA can introduce various optimizations. For example, in the case where the units are all the same, e.g. all `em` units, the UA could add them together and collapse that part of the stack.

If the UA wants to optimize further still, it could perhaps build up buckets for each unit type and add appropriate portions to each bucket. The final values of each bucket could be stuck in a single `calc()` expression that would be suitably responsive.

Implementing the above example optimizations is quite involved and the end result still does not account for variables and only applies to length/percentages.

My experience working on `FillAnimation`s for several months is that it will always be an incomplete solution. UAs can optimize for different kinds of content but the amount of complexity involved rises quickly. As a result, the implementation I wrote does not collapse additive stacks--it retains only the relevant endpoint(s) in a much more compact structure so that magnitude of the memory leak is reduced, but it still effectively leaks.

-- 
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3689#issuecomment-470013709 using your GitHub account

Received on Wednesday, 6 March 2019 08:24:36 UTC