Skip to content

Commit 06c9369

Browse files
committed
[css4-images] Tweak the interpolation section, rewrite the issue about gradient interpolation.
1 parent 14cb7bb commit 06c9369

2 files changed

Lines changed: 60 additions & 41 deletions

File tree

css4-images/Overview.html

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3535,29 +3535,40 @@ <h3 id=interpolating-image-combinations><span class=secno>7.2. </span>
35353535
<h3 id=interpolating-gradients><span class=secno>7.3. </span> Interpolating
35363536
<a href="#gradient-type"><var>&lt;gradient></var></a></h3>
35373537

3538-
<p class=issue> Redo this to actually work right with the current syntax.
3538+
<p class=issue> This section needs review and improvement. In particular, I
3539+
believe the handling of linear-gradient() is incomplete - I think we want
3540+
to specifically interpolate the "length" of the gradient line (the
3541+
distance between 0% and 100%) between the starting and ending positions
3542+
explicitly, so it doesn't grow and then shrink over a single animation.
35393543

35403544
<p> Gradient images can be interpolated directly in CSS transitions and
35413545
animations, smoothly animating from one gradient to another. There are
35423546
only a few restrictions on what gradients are allowed to be interpolated:
35433547

35443548
<ol>
35453549
<li> Both the starting and ending gradient must be expressed with the same
3546-
function. (For example, you can transition from a linear-gradient() to a
3547-
linear-gradient(), but not from a linear-gradient() to a
3548-
radial-gradient() or a repeating-linear-gradient().)
3549-
3550-
<li> Both the starting and ending gradient must have the same number of
3551-
color-stops. For this purpose, a repeating gradient is considered to have
3552-
infinite color-stops, and thus all repeating gradients have the same
3553-
number of color-stops. (Note that one may pad a gradient with additional
3554-
color-stops placed atop each other, if necessary to make two gradients
3555-
have the same number of color-stops.)
3550+
function. (For example, you can transition from a ‘<code
3551+
class=css>linear-gradient()</code>’ to a ‘<code
3552+
class=css>linear-gradient()</code>’, but not from a ‘<code
3553+
class=css>linear-gradient()</code>’ to a ‘<code
3554+
class=css>radial-gradient()</code>’ or a ‘<code
3555+
class=css>repeating-linear-gradient()</code>’.)
3556+
3557+
<li> Both the starting and ending gradient must have the same number of <a
3558+
href="#color-stop-type"><var>&lt;color-stop></var></a>s. For this
3559+
purpose, a repeating gradient is considered to have infinite <a
3560+
href="#color-stop-type"><var>&lt;color-stop></var></a>s, and thus all
3561+
repeating gradients have the same number of <a
3562+
href="#color-stop-type"><var>&lt;color-stop></var></a>s. (Note that one
3563+
may pad a gradient with additional <a
3564+
href="#color-stop-type"><var>&lt;color-stop></var></a>s placed atop each
3565+
other, if necessary to make two gradients have the same number of <a
3566+
href="#color-stop-type"><var>&lt;color-stop></var></a>s.)
35563567
</ol>
35573568

35583569
<p> If the two gradients satisfy both of those constraints, they must be
35593570
interpolated as described below. If not, they must be interpolated as a
3560-
generic image.
3571+
generic <a href="#image-type"><var>&lt;image></var></a>.
35613572

35623573
<ol>
35633574
<li> Convert both the start and end gradients to their explicit forms:
@@ -3573,15 +3584,14 @@ <h3 id=interpolating-gradients><span class=secno>7.3. </span> Interpolating
35733584
[‘<code class=css>0deg</code>’,‘<code
35743585
class=css>360deg</code>’) that would produce an equivalent
35753586
rendering.
3576-
3577-
<li> If both the start and end gradients had their direction specified
3578-
with keywords, and the absolute difference between the angles their
3579-
directions mapped to is greater than 180deg, add 360deg to the
3580-
direction of the gradient with the smaller angle. <span
3581-
class=note>This ensures that a transition from, for example, "to
3582-
left" (270deg) to "to top" (0deg) rotates the gradient a quarter-turn
3583-
clockwise, as expected, rather than rotating three-quarters of a turn
3584-
counter-clockwise.</span>
3587+
<p> If both the start and end gradients had their direction specified
3588+
with keywords, and the absolute difference between the angles their
3589+
directions mapped to is greater than 180deg, add 360deg to the
3590+
direction of the gradient with the smaller angle. <span
3591+
class=note>This ensures that a transition from, for example, "to
3592+
left" (270deg) to "to top" (0deg) rotates the gradient a
3593+
quarter-turn clockwise, as expected, rather than rotating
3594+
three-quarters of a turn counter-clockwise.</span>
35853595
</ul>
35863596

35873597
<dt>For radial gradients:
@@ -3594,7 +3604,10 @@ <h3 id=interpolating-gradients><span class=secno>7.3. </span> Interpolating
35943604

35953605
<li> Otherwise, the size must be changed to a pair of <a
35963606
href="#radial-size-circle"><var>&lt;length></var></a>s that would
3597-
produce an equivalent ending-shape.
3607+
produce an equivalent ending-shape. If the <a
3608+
href="#shape"><var>&lt;shape></var></a> was specified as ‘<code
3609+
class=css>circle</code>’, change it to ‘<code
3610+
class=css>ellipse</code>’.
35983611
</ul>
35993612
</dl>
36003613

css4-images/Overview.src.html

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,7 +2984,12 @@ <h3 id='interpolating-gradients'>
29842984
Interpolating <var>&lt;gradient></var></h3>
29852985

29862986
<p class='issue'>
2987-
Redo this to actually work right with the current syntax.
2987+
This section needs review and improvement.
2988+
In particular, I believe the handling of linear-gradient() is incomplete -
2989+
I think we want to specifically interpolate the "length" of the gradient line
2990+
(the distance between 0% and 100%)
2991+
between the starting and ending positions explicitly,
2992+
so it doesn't grow and then shrink over a single animation.
29882993

29892994
<p>
29902995
Gradient images can be interpolated directly in CSS transitions and animations,
@@ -2994,21 +2999,21 @@ <h3 id='interpolating-gradients'>
29942999
<ol>
29953000
<li>
29963001
Both the starting and ending gradient must be expressed with the same function.
2997-
(For example, you can transition from a linear-gradient() to a linear-gradient(),
2998-
but not from a linear-gradient() to a radial-gradient() or a repeating-linear-gradient().)
3002+
(For example, you can transition from a ''linear-gradient()'' to a ''linear-gradient()'',
3003+
but not from a ''linear-gradient()'' to a ''radial-gradient()'' or a ''repeating-linear-gradient()''.)
29993004

30003005
<li>
3001-
Both the starting and ending gradient must have the same number of color-stops.
3002-
For this purpose, a repeating gradient is considered to have infinite color-stops,
3003-
and thus all repeating gradients have the same number of color-stops.
3004-
(Note that one may pad a gradient with additional color-stops placed atop each other,
3005-
if necessary to make two gradients have the same number of color-stops.)
3006+
Both the starting and ending gradient must have the same number of <var>&lt;color-stop></var>s.
3007+
For this purpose, a repeating gradient is considered to have infinite <var>&lt;color-stop></var>s,
3008+
and thus all repeating gradients have the same number of <var>&lt;color-stop></var>s.
3009+
(Note that one may pad a gradient with additional <var>&lt;color-stop></var>s placed atop each other,
3010+
if necessary to make two gradients have the same number of <var>&lt;color-stop></var>s.)
30063011
</ol>
30073012

30083013
<p>
30093014
If the two gradients satisfy both of those constraints,
30103015
they must be interpolated as described below.
3011-
If not, they must be interpolated as a generic image.
3016+
If not, they must be interpolated as a generic <var>&lt;image></var>.
30123017

30133018
<ol>
30143019
<li>
@@ -3027,15 +3032,15 @@ <h3 id='interpolating-gradients'>
30273032
change its direction to an <var>&lt;angle></var> in [''0deg'',''360deg'')
30283033
that would produce an equivalent rendering.
30293034

3030-
<li>
3031-
If both the start and end gradients had their direction specified with keywords,
3032-
and the absolute difference between the angles their directions mapped to is greater than 180deg,
3033-
add 360deg to the direction of the gradient with the smaller angle.
3034-
<span class='note'>This ensures that a transition from, for example,
3035-
"to left" (270deg) to "to top" (0deg)
3036-
rotates the gradient a quarter-turn clockwise,
3037-
as expected,
3038-
rather than rotating three-quarters of a turn counter-clockwise.</span>
3035+
<p>
3036+
If both the start and end gradients had their direction specified with keywords,
3037+
and the absolute difference between the angles their directions mapped to is greater than 180deg,
3038+
add 360deg to the direction of the gradient with the smaller angle.
3039+
<span class='note'>This ensures that a transition from, for example,
3040+
"to left" (270deg) to "to top" (0deg)
3041+
rotates the gradient a quarter-turn clockwise,
3042+
as expected,
3043+
rather than rotating three-quarters of a turn counter-clockwise.</span>
30393044
</ul>
30403045

30413046

@@ -3049,8 +3054,9 @@ <h3 id='interpolating-gradients'>
30493054
<li>
30503055
Otherwise, the size must be changed to a pair of <var>&lt;length></var>s
30513056
that would produce an equivalent ending-shape.
3057+
If the <var>&lt;shape></var> was specified as ''circle'',
3058+
change it to ''ellipse''.
30523059
</ul>
3053-
30543060
</dl>
30553061

30563062

0 commit comments

Comments
 (0)