Closed jakearchibald closed 2 years ago
👍 This comment to vote for linear()
👍 This comment to vote for linear-spline()
👍 This comment to vote for ease()
👍 This comment to vote for piecewise()
👍 This comment to vote for easing()
I think lerpsequence
suggested by Paul Lewis on Twitter accurately captures the concept: It's a linear interpolation between a sequence of points.
Also lerpsequence
instead of lerp
avoids using a general term for a very animation-specific function.
Even though lerp
is commonly used in computer graphics I myself (no cg background) found the term quite to be unintuitive at times. So alternatively linearsequence
could be used if the term lerp should be avoided.
The term lerp is used nowhere on MDN nor whatwg.org and nor w3.org suggesting it's not part of "web vocabulary".
I don't think lerpsequence
/linearsequence
make it clear enough that this defines an easing function.
Why not linear-steps
?
The interpolation between steps is linear.
With ease I associate a smooth transition of values/speed as for example in After Effects, which is not the case here.
Why not
linear-steps()
?
I don't think it's useful to draw an implicit connection to steps()
, which does something relatively different. (And note that steps()
cannot be reproduced with this function anyway - steps produces discontinuous easings while this is always C0-continuous, at least.)
Strongly opposed to ease()
, as this isn't remotely related to the ease-*
keywords, all of which are specifically about smoothly curving. Similarly opposed to easing()
; it also doesn't match the conjugation of the other values. We already have a function + related keywords group (steps()
and step-*
) and this would completely break with the pattern they establish. I'd block this if it came to it.
Mildly opposed to linear-spline()
- the "spline" doesn't add anything useful, and we've omitted that word from cubic-bezier()
, which is technically a "cubic Bezier spline".
Would be okay with piecewise()
, tho I prefer linear()
over it. It's a little more complex in spelling (I'm always against words with the ie
compound if they can be avoided, as whether English spells that sound "ie" or "ei" is pretty random.) I have used "piecewise linear" to refer to functions like this; the term doesn't necessarily imply the ability to have C0 discontinuities like steps()
produces.
linear()
is definitely the best option. We've done the "keyword and function with same name" variations before (notably in pseudo-classes, but I think elsewhere?), and it fits the "keyword is the obvious default arguments to the function" pattern we use there.
(And note that
steps()
cannot be reproduced with this function anyway - steps produces discontinuous easings while this is always C0-continuous, at least.)
Huh, I thought you could? For example, steps(3, jump-end)
would be function-name(0 0% 33.3%, .333 33.3% 66.6%, .666 66.6% 100%, 1 100% 100%)
Strongly opposed to
ease()
, as this isn't remotely related to theease-*
keywords
They're pretty related, in that they all return easing functions. I think the main problem with ease
is that it's too different to the keyword.
Similarly opposed to
easing()
; it also doesn't match the conjugation of the other values.
I guess you're not convinced by future extensions that would make it non-linear, eg easing(0, ease-out to 0.5, ease-in to 1)
?
linear()
is definitely the best option
Fair enough. I guess we'd come up with a different method name if we want to allow non-linear parts.
Title: Bikeshed function name for custom easings
Question: What should we call the function that allows developers to define custom easings?
Solution: already in title and question 😜
I mean ... why do we need to find a different name for something that is already described? custom-ease()
or easing()
look like a no-brainer to me (former is not in the list though).
cubic-bezier()
also lets you create custom easings. In fact, all of CSS is customisation to some degree, so using the word 'custom' seems tautologous.
fair enough ... we have the second word left then 😊 ... the one I voted 👋
Yeah, I think the choice is coming down to linear()
vs easing()
imho ease
should not be on the list for the mentioned reason ... I hope that will be ignored as result.
I agree that ease()
or easing()
is not appropriate because this is just one particular way of defining a custom easing function (using linear segments). I think we'll likely want to add other ways of defining custom easing functions, and I suspect those other ways will likely be better. For example, we might want to support quadratic or cubic splines, or other things mentioned in wikipedia's article on Interpolation. But we may also want to allow multiple segments of such functions separated by points where the timing is less continuous, to allow features like bounces.
I think linear-easing()
also works if in the future there will be similar function around easing but not linear anymore, although if it's easing()
maybe the very last vary argument could be linear
, quadratic
, and so on? doesn't have to be all on the name, imho, if number of arguments is flexible (and reasonable) enough.
Huh, I thought you could? For example, steps(3, jump-end) would be function-name(0 0% 33.3%, .333 33.3% 66.6%, .666 66.6% 100%, 1 100% 100%)
Oh duh, indeed, that does the job. Not technically discontinuous but for all intents and purposes is.
(On that note, is it well-defined what the behavior is at such points? I forget whether steps takes the earlier or later value at its discontinuities, but we should match.)
I asked the same question in internal chat and didn't get a certain answer. From my testing it seems like last-point-wins, so that's what I've written in the spec.
How about facet()? To my mind at least, a faceted surface (think cut diamond) fits as a visual representation of how a curve is drawn with linear lines between multiple points.
I agree that
ease()
oreasing()
is not appropriate because this is just one particular way of defining a custom easing function (using linear segments).
Also, the property for using these functions in Web animations is called easing
and there has been a proposal to introduce an animation-easing
property to CSS animations that would allow setting the easing across all keyframes (as opposed to per-keyframe). In either case, a function with easing
in the name would be a little redundant, as in { easing: 'easing(...)' }
or animation-easing: easing(...)
.
I don't think it's any more redundant than
background-image: image(…)
Yeah, I don't think that redundancy is problematic, I'm just strongly against ease()
as a name for this feature for other reasons.
I'm going to go with linear()
. I realise that isn't the one that got the highest vote, but I'm swayed by the points against ease()
and easing()
.
I've applied this change in https://github.com/jakearchibald/csswg-drafts/pull/1
What should we call the function that allows developers to define custom easings?
Feature description
The arguments are a comma-separated groups of: - Output (number) - Start input (optional, percentage) - End input (optional, percentage) The values work very similar to `linear-gradient`. `function-name(0, 0.7, 0.87, 0.98, 1)` - this creates 5 points:Option 1:
linear()
Why:
linear
is already an easing keyword. It would be redefined to be shorthand forlinear(0, 1)
.linear-gradient()
, which starts withlinear
(although there 'linear' mostly refers to direction than interpolation).Why not:
People seem initially confused by this, as they expect linear to be a single line. When I explain "but it's still linear, but between points", they roll their eyes as if I've found a loophole 😄
Option 2:
linear-spline()
Why:
Why not:
Option 3:
ease()
Why:
ease
,ease-in
,ease-out
etc.ease(0, ease-out to 0.5, ease-in to 1)
Why not:
ease
already exists as a shothand keyword forcubic-bezier(0.25, 0.1, 0.25, 1)
, so the keyword usage is pretty different to the function usage.Option 3.5:
easing()
As above, but avoids the naming clash with the keyword
ease
.Option 4:
piecewise()
Why:
Why not:
Note: This is a discussion of the function name only, not the format of the function overall.