Skip to content

Commit e43d626

Browse files
committed
[css-easing-2] Ohhh, *that's* what the before flag does. Literally unexplained anywhere.
1 parent fde5f1b commit e43d626

File tree

1 file changed

+32
-35
lines changed

1 file changed

+32
-35
lines changed

css-easing-2/Overview.bs

+32-35
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ an [=input progress value=] and produces an [=output progress value=].
136136
An [=easing function=] must be a pure function meaning that for a given set of
137137
inputs, it always produces the same [=output progress value=].
138138

139-
The <dfn>input progress value</dfn> is a real number in the range [-&infin;,
139+
The <dfn export for="easing function">input progress value</dfn> is a real number in the range [-&infin;,
140140
&infin;].
141141
Typically, the [=input progress value=] is in the range [0, 1] but this may
142142
not be the case when [=easing functions=] are chained together.
@@ -154,7 +154,7 @@ may be outside the range [0, 1].
154154

155155
</div>
156156

157-
The <dfn>output progress value</dfn> is a real number in the
157+
The <dfn export for="easing function">output progress value</dfn> is a real number in the
158158
range [-&infin;, &infin;].
159159

160160
Note: While CSS numbers have a theoretically infinite range
@@ -164,18 +164,18 @@ If easing functions are used outside of the CSS context,
164164
care must be taken to either correctly handle potential infinities,
165165
or clamp the [=output progress value=].
166166

167-
Some types of easing functions also take an additional boolean <dfn export for="easing function">before flag</dfn>,
168-
which is defined subsequently.
167+
Some types of easing functions
168+
also take an additional boolean <dfn export for="easing function">before flag</dfn>,
169+
which indicates the easing has not yet started,
170+
or is going in reverse and is past the finish.
169171

170-
This specification defines four types of easing functions whose definitions
171-
follow.
172+
This specification defines several types of easing functions:
172173

173-
The syntax for specifying an [=easing function=] is as follows:
174-
175-
<div class="prod"><dfn type>&lt;easing-function&gt;</dfn> =
176-
<<linear-easing-function>> |
177-
<<cubic-bezier-easing-function>> |
178-
<<step-easing-function>></div>
174+
<pre class="prod">
175+
<dfn>&lt;easing-function&gt;</dfn> = <<linear-easing-function>>
176+
| <<cubic-bezier-easing-function>>
177+
| <<step-easing-function>>
178+
</pre>
179179

180180
<wpt>
181181
timing-functions-syntax-computed.html
@@ -349,15 +349,16 @@ Output</h4>
349349
return the [=output progress value=]
350350
of that item.
351351

352-
3. If at least one of |points| has an [=input progress value=]
353-
matching |inputProgress|:
352+
3. If |inputProgress| matches the [=input progress value=]
353+
of the first point in |points|,
354+
and the [=before flag=] is true,
355+
return the first point's [=output progress value=].
354356

355-
* If the [=before flag=] is true,
356-
return the [=output progress value=] of the first such point.
357-
* Otherwise,
358-
return the [=output progress value=] of the last such point.
357+
4. If |inputProgress| matches the [=input progress value=]
358+
of at least one point in |points|,
359+
return the [=output progress value=] of the last such point.
359360

360-
4. Otherwise, find two [=linear()/control points=],
361+
5. Otherwise, find two [=linear()/control points=] in |points|,
361362
|A| and |B|,
362363
which will be used for interpolation:
363364

@@ -378,7 +379,7 @@ Output</h4>
378379
and let |B| be the first [=linear()/control point=]
379380
whose [=input progress value=] is larger than |inputProgress|.
380381

381-
5. Linearly interpolate (or extrapolate) |inputProgress|
382+
6. Linearly interpolate (or extrapolate) |inputProgress|
382383
along the line defined by |A| and |B|,
383384
and return the result.
384385
</div>
@@ -830,32 +831,28 @@ Output</h4>
830831
perform the following.
831832
It returns an [=output progress value=].
832833

833-
1. Let |steps| be |func|'s [=steps()/steps=],
834+
1. If the [=before flag=] is true, return 0.
835+
836+
2. Let |steps| be |func|'s [=steps()/steps=],
834837
and |position| be |func|'s [=steps()/step position=].
835838

836-
2. Divide the interval [-&infin;, &infin;] into several segments,
839+
3. Divide the interval [-&infin;, &infin;] into several segments,
837840
each with an associated value,
838841
as follows:
839842

840843
1. [-&infin;, 0] has the value 0.
841-
2. [1, &infin;] has the value 1.
844+
2. (1, &infin;] has the value 1.
842845
3. [0, 1] is divided into |steps| intervals,
846+
[0, ...) to [..., 1)
843847
with their values assigned as defined for the |position|
844848
(see <<step-position>>).
845849

846-
Note: All intervals are inclusive,
847-
so some values are part of two intervals at once.
848-
849-
3. If |inputProgress| is in a single interval,
850-
return the associated value for that interval.
851-
852-
4. Otherwise, |inputProgress| is in two intervals,
853-
with two associated values
854-
(which might be the same).
850+
Note: In other words,
851+
at the boundary between intervals,
852+
the associated value is the higher value.
855853

856-
If the [=before flag=] is true,
857-
return the smaller associated value;
858-
otherwise, return the larger associated value.
854+
4. Return the associated value
855+
for the interval that |inputProgress| is in.
859856
</div>
860857

861858
<div class=example>

0 commit comments

Comments
 (0)