@@ -218,8 +218,8 @@ to an [=output progress value=].
218
218
<figcaption>
219
219
''linear(0, .1 25%, .75 50%, 1)'' <br>
220
220
The shape of the curve follows the [=linear()/control points=] .<br>
221
- Input progress values serve as <var> x</var> values of the curve,
222
- whilst the <var> y</var> values are the output progress values.
221
+ Input progress values serve as <var ignore > x</var> values of the curve,
222
+ whilst the <var ignore > y</var> values are the output progress values.
223
223
</figcaption>
224
224
</figure>
225
225
@@ -574,11 +574,10 @@ Cubic Bézier Easing Functions:
574
574
A <dfn export>cubic Bézier easing function</dfn>
575
575
is an [=easing function=] that interpolates smoothly from 0 to 1
576
576
using a cubic polynomial,
577
- influenced by two control points <var> P1 </var> and <var> P2 </var>
577
+ influenced by two control points
578
578
that the curve will approach
579
579
but (usually) not actually reach.
580
- (The "endpoints" of the cubic Bézier,
581
- referred to as <var> P0</var> and <var> P3</var> ,
580
+ (The "endpoints" of the cubic Bézier
582
581
are fixed at (0,0) and (1,1), respectively.)
583
582
584
583
<figure>
@@ -587,9 +586,9 @@ are fixed at (0,0) and (1,1), respectively.)
587
586
<figcaption>
588
587
A cubic Bézier curve used as an easing function.<br>
589
588
The shape of the curve is determined by the location of the control
590
- points <var> P1</var> and <var> P2</var> .<br>
591
- Input progress values serve as <var> x</var> values of the curve,
592
- whilst the <var> y</var> values are the output progress values.
589
+ points <var ignore > P1</var> and <var ignore > P2</var> .<br>
590
+ Input progress values serve as <var ignore > x</var> values of the curve,
591
+ whilst the <var ignore > y</var> values are the output progress values.
593
592
</figcaption>
594
593
</figure>
595
594
@@ -605,29 +604,27 @@ A <a>cubic Bézier easing function</a> has the following syntax:
605
604
The meaning of each value is as follows:
606
605
607
606
<dl dfn-type="value" dfn-for="<cubic-bezier-easing-function> ">
608
-
609
- : <dfn>ease-in</dfn>
610
- :: A function that starts slowly and smoothly, then quickly approaches the endpoint with an almost linear curve.
611
- Equivalent to ''cubic-bezier(0.42, 0, 1, 1)'' .
612
- : <dfn>ease-out</dfn>
613
- :: A function that starts quickly with an almost linear curve, then slowly and smoothly approaches the endpoint.
614
- Equivalent to ''cubic-bezier(0, 0, 0.58, 1)'' .
615
- : <dfn>ease-in-out</dfn>
616
- :: A function that starts and ends slowly and smoothly, quickly traversing the middle part.
617
- Equivalent to ''cubic-bezier(0.42, 0, 0.58, 1)'' .
618
- : <dfn>ease</dfn>
619
- :: Similar to ''ease-in-out'' , but with a quicker start and a slower finish.
620
- Equivalent to ''cubic-bezier(0.25, 0.1, 0.25, 1)'' .
621
- : ''cubic-bezier( x1, y1, x2, y2 )''
622
- :: Specifies a <a>cubic Bézier easing function</a> .
623
- The <var ignore> x1</var> and <var ignore> y1</var> arguments
624
- specify the <var> P1</var> control point,
625
- and <var ignore> x2</var> and <var ignore> y2</var> arguments
626
- specify the <var> P2</var> control point.
627
-
628
- Both <var ignore> x</var> values must be in the range [0, 1]
629
- or the definition is invalid.
630
-
607
+ : <dfn>ease-in</dfn>
608
+ :: A function that starts slowly and smoothly, then quickly approaches the endpoint with an almost linear curve.
609
+ Equivalent to ''cubic-bezier(0.42, 0, 1, 1)'' .
610
+ : <dfn>ease-out</dfn>
611
+ :: A function that starts quickly with an almost linear curve, then slowly and smoothly approaches the endpoint.
612
+ Equivalent to ''cubic-bezier(0, 0, 0.58, 1)'' .
613
+ : <dfn>ease-in-out</dfn>
614
+ :: A function that starts and ends slowly and smoothly, quickly traversing the middle part.
615
+ Equivalent to ''cubic-bezier(0.42, 0, 0.58, 1)'' .
616
+ : <dfn>ease</dfn>
617
+ :: Similar to ''ease-in-out'' , but with a quicker start and a slower finish.
618
+ Equivalent to ''cubic-bezier(0.25, 0.1, 0.25, 1)'' .
619
+ : ''cubic-bezier( x1, y1, x2, y2 )''
620
+ :: Specifies a <a>cubic Bézier easing function</a> .
621
+ The <var ignore> x1</var> and <var ignore> y1</var> arguments
622
+ specify the first control point,
623
+ and <var ignore> x2</var> and <var ignore> y2</var> arguments
624
+ specify the second control point.
625
+
626
+ Both <var ignore> x</var> values must be in the range [0, 1]
627
+ or the definition is invalid.
631
628
</dl>
632
629
633
630
The keyword values listed above are illustrated below.
@@ -657,40 +654,77 @@ The keyword values listed above are illustrated below.
657
654
</figcaption>
658
655
</figure>
659
656
657
+ <h4 id="bezier-serialization">
658
+ Serializing</h4>
660
659
661
- <h4 id=cubic-bezier-algo>
662
- Output</h4>
663
-
664
- The mapping from input progress to output progress is performed by
665
- determining the corresponding <var> y</var> value ([=output progress value=] ) for
666
- a given <var> x</var> value ([=input progress value=] ).
667
- The evaluation of this curve is covered in many sources such as
668
- [[FUND-COMP-GRAPHICS]] .
669
-
670
- For [=input progress values=] outside the range [0, 1] , the curve is extended
671
- infinitely using tangent of the curve at the closest endpoint as follows:
660
+ The ''ease-in'' , ''ease-out'' , ''ease-in-out'' , and ''ease'' keywords
661
+ serialize as themselves.
672
662
673
- * For [=input progress values=] less than zero,
663
+ <div algorithm>
664
+ To <dfn export>serialize a cubic-bezier() function</dfn> :
674
665
675
- 1. If the <var> x</var> value of <var> P1</var> is greater than zero, use
676
- a straight line that passes through <var> P1</var> and <var> P0</var> as the tangent.
666
+ 1. Let |s| be the string "cubic-bezier(".
677
667
678
- 1. Otherwise, if the <var> x</var> value of <var> P2</var> is greater than
679
- zero, use a straight line that passes through <var> P2</var> and <var> P0</var> as the tangent.
668
+ 2. Serialize the function's four arguments as <<number>> s,
669
+ [=concatenate=] the results using the separator ", ",
670
+ and append the result to |s|.
680
671
681
- 1. Otherwise, let the [=output progress value=] be zero for all
682
- [=input progress values=] in the range [-∞, 0).
672
+ 3. Append ")" to |s|, and return it.
673
+ </div>
683
674
684
- * For [=input progress values=] greater than one,
685
675
686
- 1. If the <var> x </var> value of <var> P2 </var> is less than one, use
687
- a straight line that passes through <var> P2 </var> and <var> P3 </var> as the tangent.
676
+ <h4 id=cubic-bezier-algo>
677
+ Output</h4>
688
678
689
- 1. Otherwise, if the <var> x</var> value of <var> P1</var> is less than
690
- one, use a straight line that passes through <var> P1</var> and <var> P3</var> as the tangent.
679
+ <div algorithm>
680
+ To <dfn export lt="calculate cubic Bézier easing output progress|calculate cubic Bezier easing output progress">calculate cubic Bézier easing output progress</dfn>
681
+ for a given [=cubic Bézier easing function=] |func|
682
+ and an [=input progress value=] |inputProgress|,
683
+ perform the following.
684
+ It returns an [=output progress value=] .
691
685
692
- 1. Otherwise, let the [=output progress value=] be one for all
693
- [=input progress values=] in the range (1, ∞].
686
+ 1. Let |p0| be the point (0,0),
687
+ |p1| be the point given by |func|'s first two arguments,
688
+ |p2| be the point given by |func|'s second two arguments,
689
+ and |p3| be the point (1,1).
690
+
691
+ 2. If |inputProgress| is within the range [0,1] (inclusive),
692
+ return the y value
693
+ corresponding to |inputProgress| as an x value
694
+ for the cubic Bézier curve
695
+ defined as having |p0| and |p3| as endpoints,
696
+ and |p1| and |p2| as control points.
697
+
698
+ The evaluation of this curve is covered in many sources,
699
+ such as [[FUND-COMP-GRAPHICS]] .
700
+
701
+ 3. Otherwise, the curve is extended infinitely,
702
+ using the tangent of the curve at the endpoints.
703
+ This tangent is defined as the line between two points,
704
+ |t1| and |t2|.
705
+
706
+ * If |inputProgress| is less than 0,
707
+ let |t1| be |p0|.
708
+
709
+ 1. If the x value of |p1| is greater than 0,
710
+ let |t2| be |p1|.
711
+ 2. Otherwise, if the x value of |p2| is greater than 0,
712
+ let |t2| be |p2|.
713
+ 3. Otherwise, return 0.
714
+
715
+ * If |inputProgress| is greater than 1,
716
+ let |t2| be |p3|.
717
+
718
+ 1. If the x value of |p2| is less than 1,
719
+ let |t1| be |p2|.
720
+ 2. Otherwise, if the x value of |p1| is less than 1,
721
+ let |t1| be |p1|.
722
+ 3. Otherwise, return 1.
723
+
724
+ Return the y value
725
+ corresponding to |inputProgress| as an x value
726
+ for the line passing through |t1| and |t2|.
727
+ </div>
694
728
695
729
<wpt>
696
730
cubic-bezier-timing-functions-output.html
@@ -967,11 +1001,6 @@ and [=before flag=] as follows:
967
1001
Easing functions are serialized using the common serialization patterns
968
1002
defined in [[CSSOM]] with the following additional requirements:
969
1003
970
- * The keyword values ''ease'' , ''linear'' , ''ease-in'' , ''ease-out'' ,
971
- and ''ease-in-out'' are serialized as-is, that is, they are
972
- <em> not</em> converted to the equivalent ''cubic-bezier()'' or
973
- ''linear()'' function before serializing.
974
-
975
1004
* Step easing functions, whether they are specified using the
976
1005
''steps()'' function or either of the ''step-start'' or ''step-end''
977
1006
keywords, are serialized as follows:
@@ -982,9 +1011,6 @@ defined in [[CSSOM]] with the following additional requirements:
982
1011
2. Otherwise, serialize as <a lt="steps()"
983
1012
function>steps(<integer>, <step-position>)</a> .
984
1013
985
- * A [=linear easing function=] created via ''linear()''
986
- is serialized by getting its [=linear easing function/serialized computed value=] .
987
-
988
1014
<wpt>
989
1015
timing-functions-syntax-computed.html
990
1016
</wpt>
0 commit comments