@@ -578,9 +578,10 @@ Representing Interpolated Values: the ''mix()'' notation</h3>
578
578
rather than the more typical comma
579
579
because the values themselves can contain commas.
580
580
581
+
581
582
If the two <<declaration-value>> s in ''mix()'' are [=interpolation|interpolable=]
582
- (without using ''mix()'' itself)
583
583
as values for the property in which it is specified,
584
+ and the interpolated value can be represented without ''mix()'' ,
584
585
the [=computed value=] of ''mix()'' is
585
586
the result of interpolating these two values
586
587
to the progress given by the <<percentage>> .
@@ -591,6 +592,39 @@ Representing Interpolated Values: the ''mix()'' notation</h3>
591
592
and both <<declaration-value>> s computed
592
593
as values for this property.
593
594
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
+
594
628
A ''mix()'' notation is invalid
595
629
if it is not the sole value of the property;
596
630
if either of its <<declaration-value>> s
@@ -601,15 +635,16 @@ Representing Interpolated Values: the ''mix()'' notation</h3>
601
635
<div class="example">
602
636
For example, the following declarations are invalid,
603
637
and will be ignored:
638
+
604
639
<pre>
605
640
/* Invalid start value */
606
641
color: mix(90% ; #invalid ; #F00);
607
642
608
643
/* Function is mixed with other values */
609
644
background: url(ocean) mix(10% ; blue ; yellow);
610
645
611
- /* 'display ' is not animatable */
612
- display : mix(0% ; inline ; block );
646
+ /* 'animation-* ' is not animatable */
647
+ animation-delay : mix(0% ; 0s ; 2s );
613
648
</pre>
614
649
</div>
615
650
0 commit comments