Skip to content

[css-properties-values-api-1] Allow customizing property animation interpolation curve #5920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
flackr opened this issue Feb 2, 2021 · 5 comments

Comments

@flackr
Copy link
Contributor

flackr commented Feb 2, 2021

In #4953 we decided that ratios should be interpolated using a log curve to avoid asymmetric acceleration as the aspect ratio division result approaches 0 (i.e. make aspect ratio interpolation visually appear linear regardless of whether interpolating to/from a narrow or wide aspect ratio). In the blink intent thread it was brought up that having a one-off different interpolation curve for aspect-ratio seemed strange and that we should consider allowing customization of this.

Defining the implicit interpolation curve for a new property might be a good fit as part of a PropertyDefinition to allow developers to define other properties where the default linear interpolation curve doesn't make sense.

@tabatkins
Copy link
Member

Well this brings up the question of whether the rules for interpolating <ratio> should indeed be generic for <ratio> or specific to 'aspect-ratio', right? I believe the answer is that they should be generic to <ratio>, so it's a per-type control (and types aren't user-extensible, at least not yet).

That said, the larger point of allowing more customizeable control over property animations is legit. This is tied into the earlier "apply hook" ideas (still captured in a draft document in the Houdini repo, not served publicly), letting authors control how a property went from specified->computed.

@flackr
Copy link
Contributor Author

flackr commented Feb 3, 2021

I'm not sure that we shouldn't have property specific interpolation overrides. Imagine that we didn't have ratios defined yet, the developer could define aspect-ratio as a regular number type but give it logarithmic interpolation.

@tabatkins
Copy link
Member

I agreed with that in the previous comment, yeah. ^_^

@flackr
Copy link
Contributor Author

flackr commented Feb 3, 2021

Sorry, I think I may have misunderstood. Just to make sure I'm following because I think what you said solves the problem of interpolation but has a slight difference from what I said:

I think you're suggesting the dev could have an apply hook which would convert the specified --user-aspect-ratio property into its logarithm in the computed style? However, I think this would mean reading the computed value would then give you the log of the aspect ratio, right? Or do apply hooks allow devs to define how the computed value is read back?

@tabatkins
Copy link
Member

I'm saying that animated value and computed value are very close concepts (in the cascade and semantically), and we already have some early attempts at letting authors customize computed values of custom properties, so letting them customize animated values also makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants