Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b4bad72
Calculating progress & serialising linear-spline
jakearchibald Jun 24, 2022
1c326ef
Define function creation
jakearchibald Jun 24, 2022
1e5b11d
Update largest number when inferring 0 for the first item
jakearchibald Jun 24, 2022
a4c01be
Simplify serialisation
jakearchibald Jun 27, 2022
8276f40
Spec tidy up
jakearchibald Jun 27, 2022
0e5043f
Connecting parsing and serialising
jakearchibald Jun 27, 2022
f621932
Fix indenting
jakearchibald Jun 27, 2022
ef29eae
Dark mode figures
jakearchibald Jul 6, 2022
2739467
Merge remote-tracking branch 'origin/main' into css-easing-2-linear-s…
jakearchibald Jul 6, 2022
05473a9
Markdown headings
jakearchibald Jul 6, 2022
f3c7508
Switch back to linear()
jakearchibald Jul 6, 2022
973a84a
Missed a few old spline references
jakearchibald Jul 7, 2022
c6fe005
Examples
jakearchibald Jul 8, 2022
c51794a
Existing examples are good enough IMO
jakearchibald Jul 8, 2022
8e38422
Forgot to specify 'index'
jakearchibald Jul 8, 2022
8fbc910
Missing comma
jakearchibald Jul 8, 2022
5221e11
Adding serialization examples
jakearchibald Jul 10, 2022
589a383
Be more specific about the linear keyword
jakearchibald Jul 10, 2022
ce4c5d1
A little more specific about the serialization of linear()
jakearchibald Jul 11, 2022
932ce07
Apply suggestions from code review
jakearchibald Jul 12, 2022
a509029
Fixes following review
jakearchibald Jul 12, 2022
d75bd5c
Clarify note
jakearchibald Jul 12, 2022
bdbb745
Make all graphs transparent
jakearchibald Jul 17, 2022
17e0ad3
One more
jakearchibald Jul 17, 2022
8ee8bf2
Move examples after normative text
jakearchibald Jul 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Spec tidy up
  • Loading branch information
jakearchibald committed Jun 27, 2022
commit 8276f409da8cc91eca5a4939f34a3c32f98b78c9
65 changes: 37 additions & 28 deletions css-easing-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,8 @@ The syntax for the [=linear easing function=] is simply the

<dfn function lt="linear-spline()">linear-spline(<<linear-spline-stop-list>>)</dfn>

<pre class="prod">
<dfn>&lt;linear-spline-stop-list></dfn> = [ <<linear-spline-stop>> ]#
<dfn>&lt;linear-spline-stop></dfn> = <<number>> && <<linear-spline-stop-length>>?
<dfn>&lt;linear-spline-stop-length></dfn> = <<percentage>>{1,2}
</pre>

''linear-spline()'' is parsed into a [=linear spline easing function=]
by calling [=create a linear easing function=],
passing in its <<linear-spline-stop-list>>.
There must be at least two <<linear-spline-stop>>s.

A <dfn export>linear spline easing function</dfn>
is an easing function
is an [=easing function=]
that interpolates linearly
between its [=linear spline easing function/points=].

Expand All @@ -166,70 +155,88 @@ that has:
: <dfn>input</dfn>
:: A number or null

Note: This is only null during [=create a linear easing function=].
Note: This is only null during [=create a linear easing function=].

: <dfn>output</dfn>
:: A number

</dl>

<h4 id=linear-spline-easing-function-syntax>Syntax</h4>

<pre class="prod">
<dfn>&lt;linear-spline-stop-list></dfn> = [ <<linear-spline-stop>> ]#
<dfn>&lt;linear-spline-stop></dfn> = <<number>> && <<linear-spline-stop-length>>?
<dfn>&lt;linear-spline-stop-length></dfn> = <<percentage>>{1,2}
</pre>

''linear-spline()'' is parsed into a [=linear spline easing function=]
by calling [=create a linear easing function=],
passing in its <<linear-spline-stop-list>> as a [=/list=] of <<linear-spline-stop>>s.

<h4 id=linear-spline-easing-function-parsing>Parsing</h4>

<section algorithm="to create a linear easing function">

To <dfn>create a linear easing function</dfn>
from a <<linear-spline-stop-list>> |stopList|,
given a [=/list=] of <<linear-spline-stop>>s |stopList|,
perform the following.
It returns a [=linear spline easing function=].

1. Let |function| be a new [=linear spline easing function=].

1. Let |largestInput| be negative infinity.

1. For each |stop| in |stopList|:
1. If there are less than two [=list/items=] in |stopList|, then return failure.

1. [=list/For each=] |stop| in |stopList|:

1. Let |point| be a new [=linear spline easing point=]
with its [=linear spline easing point/output=] set to |stop|'s <<number>> as a number.
with its [=linear spline easing point/output=] set to |stop|'s <<number>> as a number.

1. [=list/Append=] |point| to |function|'s [=linear spline easing function/points=].

1. If |stop| has a <<linear-spline-stop-length>>, then:

1. Set |point|'s [=linear spline easing point/input=] to whichever is greater:
|stop|'s <<linear-spline-stop-length>>'s first <<percentage>> as a number,
or |largestInput|.
|stop|'s <<linear-spline-stop-length>>'s first <<percentage>> as a number,
or |largestInput|.

1. Set |largestInput| to |point|'s [=linear spline easing point/input=].

1. If |stop|'s <<linear-spline-stop-length>> has a second <<percentage>>, then:

1. Let |extraPoint| be a new [=linear spline easing point=]
1. Let |extraPoint| be a new [=linear spline easing point=]
with its [=linear spline easing point/output=] set to |stop|'s <<number>> as a number.

1. [=list/Append=] |extraPoint| to |function|'s [=linear spline easing function/points=].
1. [=list/Append=] |extraPoint| to |function|'s [=linear spline easing function/points=].

1. Set |extraPoint|'s [=linear spline easing point/input=] to whichever is greater:
1. Set |extraPoint|'s [=linear spline easing point/input=] to whichever is greater:
|stop|'s <<linear-spline-stop-length>>'s second <<percentage>> as a number,
or |largestInput|.

1. Set |largestInput| to |extraPoint|'s [=linear spline easing point/input=].
1. Set |largestInput| to |extraPoint|'s [=linear spline easing point/input=].

1. Otherwise, if |stop| is the first [=list/item=] in |stopList|, then:

1. Set |point|'s [=linear spline easing point/input=] to 0.
1. Set |point|'s [=linear spline easing point/input=] to 0.

1. Set |largestInput| to |point|'s [=linear spline easing point/input=].
1. Set |largestInput| to 0.

1. Otherwise, if |stop| is the last [=list/item=] in |stopList|,
then set |point|'s [=linear spline easing point/input=] to whichever is greater:
1 or |largestInput|.
then set |point|'s [=linear spline easing point/input=] to whichever is greater:
1 or |largestInput|.

1. For runs of [=list/items=] in |function|'s [=linear spline easing function/points=] that have a null [=linear spline easing point/input=],
assign a number to the [=linear spline easing point/input=] by linearly interpolating between the closest previous and next [=linear spline easing function/points=]
that have a non-null [=linear spline easing point/input=].
assign a number to the [=linear spline easing point/input=] by linearly interpolating between the closest previous and next [=linear spline easing function/points=]
that have a non-null [=linear spline easing point/input=].

1. Return |function|.

</section>

<h4 id=linear-spline-easing-function-serializing>Serializing</h4>

<section algorithm="linear spline easing function">

To get a [=linear spline easing function=]'s (|linearSplineEasingFunction|) <dfn for="linear spline easing function" export>serialized computed value</dfn>
Expand Down Expand Up @@ -259,6 +266,8 @@ It returns a [=string=].

</section>

<h4 id=linear-spline-easing-function-output>Output of a linear spline easing function</h4>

<section algorithm="to calculate linear spline output progress">

To <dfn export>calculate linear spline output progress</dfn>
Expand Down