Skip to content

Commit 9a702d6

Browse files
committed
[css-values-4][editorial] Added more examples, slightly rephrased some bits without changing meaning. #9343
1 parent 54be250 commit 9a702d6

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

css-values-4/Overview.bs

+38-3
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,10 @@ Representing Interpolated Values: the ''mix()'' notation</h3>
578578
rather than the more typical comma
579579
because the values themselves can contain commas.
580580

581+
581582
If the two <<declaration-value>>s in ''mix()'' are [=interpolation|interpolable=]
582-
(without using ''mix()'' itself)
583583
as values for the property in which it is specified,
584+
and the interpolated value can be represented without ''mix()'',
584585
the [=computed value=] of ''mix()'' is
585586
the result of interpolating these two values
586587
to the progress given by the <<percentage>>.
@@ -591,6 +592,39 @@ Representing Interpolated Values: the ''mix()'' notation</h3>
591592
and both <<declaration-value>>s computed
592593
as values for this property.
593594

595+
<div class="example">
596+
For example, most uses of ''mix()''
597+
will resolve at computed-value time:
598+
599+
<pre>
600+
color: mix(90%; red; blue);
601+
/* via simple interpolation,
602+
computes to: */
603+
color: rgb(10% 0 90%);
604+
605+
color: mix(90%; currentcolor; black);
606+
/* can't be fully resolved at computed-value time,
607+
but still has a defined representation: */
608+
color: color-mix(currentcolor 90%, black 10%);
609+
610+
float: mix(90%; left; right);
611+
/* discretely animatable */
612+
float: right;
613+
</pre>
614+
615+
But a few cases don't have an intermediate representation:
616+
617+
<pre>
618+
transform: mix(90%; translate(calc(1em + 50%)); rotate(30deg));
619+
/* because functions don't match, it will interpolate
620+
via matrix(). But translate(%) needs layout
621+
information to turn into a matrix(), so the
622+
interpolated value can't actually be represented.
623+
Computes to: */
624+
transform: mix(90%; translate(calc(16px + 50%)); rotate(30deg));
625+
</pre>
626+
</div>
627+
594628
A ''mix()'' notation is invalid
595629
if it is not the sole value of the property;
596630
if either of its <<declaration-value>>s
@@ -601,15 +635,16 @@ Representing Interpolated Values: the ''mix()'' notation</h3>
601635
<div class="example">
602636
For example, the following declarations are invalid,
603637
and will be ignored:
638+
604639
<pre>
605640
/* Invalid start value */
606641
color: mix(90% ; #invalid ; #F00);
607642

608643
/* Function is mixed with other values */
609644
background: url(ocean) mix(10% ; blue ; yellow);
610645

611-
/* 'display' is not animatable */
612-
display: mix(0% ; inline ; block);
646+
/* 'animation-*' is not animatable */
647+
animation-delay: mix(0% ; 0s ; 2s);
613648
</pre>
614649
</div>
615650

0 commit comments

Comments
 (0)