-
Notifications
You must be signed in to change notification settings - Fork 757
Description
Problem statement
Width/height animations are pretty common, and we've recently enhanced them with interpolate-size. They are becoming more common as view transitions use them by default.
However, width/height animations require a layout in every frame, which means they can't run on the compositor.
This is causing performance issues to some of our partners, some having to resort to building scale animations by hand.
Proposal
Suggesting to allow some option that lets the browser converting a width/height animation into a scale animation.
This would look different from the default width/height animation, as the contents are scaled proportionally rather than have their layout recomputed, but in many cases this is a good tradeoff.
Issues
One issue with this is that it's unclear which size is used for layout (while the other one is used to scale).
Another issue is how this works in practice, and reflected in computed style.
A possible way make it work
A CSS property defining that size animates as scale, and which size to use for layout:
size-animation: normal | scale-old | scale-new (or some such).
When this property is other than normal, it affects the width, height and scale values used for interpolation, and thus their computed style during interpolation:
widthandheightare set to the same value on both sides, either the old or new onescaleis adjusted to the appropriate values on both sides.- An explicit
scaleanimation overrides this. Otherwise a new property would be needed and it's perhaps an overkill.