You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For color functions with a hue angle (LCH, HSL, HWB etc), there are multiple ways to interpolate.
730
-
We typically want to avoid arcs over 360, as they are rarely desirable,
730
+
We typically want to avoid arcs over 360 for the difference between the angles, as they are rarely desirable,
731
731
so in most cases angles are fixed up prior to interpolation so that per-component interpolation is done over less than 360 degrees, often less than 180.
732
+
732
733
Host syntax can specify any of the following algorithms for hue interpolation
733
-
(angles in the following are in degrees, but the logic is the same regardless of how they are specified):
734
+
(angles in the following are in degrees, but the logic is the same regardless of how they are specified).
735
+
736
+
Unless the type of hue interpolation is ''specified'', both angles need to be constrained to [0, 360) prior to interpolation.
737
+
One way to do this is <code><i>θ</i> = ((<i>θ</i> % 360) + 360) % 360</code>.
734
738
735
739
: ''shorter''
736
740
:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 180). In pseudo-Javascript:
@@ -746,11 +750,11 @@ Host syntax can specify any of the following algorithms for hue interpolation
746
750
: ''longer''
747
751
:: Angles are adjusted so that θ₂ - θ₁ ∈ [180, 360). In pseudo-Javascript:
748
752
<pre>
749
-
if (θ₂ - θ₁ <= 180) {
750
-
θ₂ += 360;
753
+
if (0 < θ₂ - θ₁ < 180) {
754
+
θ₁ += 360;
751
755
}
752
-
else if (θ₂ - θ₁ >= -180) {
753
-
θ₁ += 360;
756
+
else if (-180 < θ₂ - θ₁ < 0) {
757
+
θ₂ += 360;
754
758
}
755
759
</pre>
756
760
@@ -775,7 +779,6 @@ Host syntax can specify any of the following algorithms for hue interpolation
775
779
776
780
Unless otherwise specified, if no specific hue interpolation algorithm is selected by the host syntax, the default is ''shorter''.
0 commit comments