@@ -1116,9 +1116,6 @@ Cycle Detection</h4>
1116
1116
If the graph contains a cycle,
1117
1117
any ''element()'' functions participating in the cycle are <a>invalid images</a> .
1118
1118
1119
-
1120
-
1121
-
1122
1119
<!--
1123
1120
██████ ████████ ███ ████████ ████ ████████ ██ ██ ████████ ██████
1124
1121
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██
@@ -1897,15 +1894,90 @@ Color Stop “Fixup”</h4>
1897
1894
</pre>
1898
1895
</div>
1899
1896
1900
-
1901
-
1897
+ <!--
1898
+ ██████ ████████ ████████ ████ ████████ ███████ ██████ ███ ███
1899
+ ██ ██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██ ██
1900
+ ██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██
1901
+ ██████ ██ ████████ ██ ████████ █████ ██████ ██ ██
1902
+ ██ ██ ██ ██ ██ ██ █ ██ ██ ██
1903
+ ██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██ ██
1904
+ ██████ ██ ██ ██ ████ ██ ███████ ██████ ███ ███
1905
+ -->
1902
1906
1903
1907
1D Image Values: the ''stripes()'' notation {#stripes}
1904
1908
======================================================
1905
1909
1906
- Issue: <a href="https://github.com/w3c/csswg-drafts/issues/2532">Per WG resolution</a> ,
1907
- define the ''stripes()'' function
1908
- which creates a 1D image for use in borders/outlines.
1910
+ While most <<image>> values represent a 2-dimensional image,
1911
+ and <<color>> can be thought of as a "0-dimensional" image
1912
+ (unvarying in either axis),
1913
+ there are some contexts where a 1-dimensional image makes sense,
1914
+ specifying colors along a <dfn export>paint line</dfn>
1915
+ without defining a <em> direction</em> for the line.
1916
+ The <<1d-image>> type represents such images.
1917
+
1918
+ <pre class=prod>
1919
+ <dfn><1d-image></dfn> = <<stripes()>>
1920
+ <dfn>stripes()</dfn> = stripes( <<color-stripe>> # )
1921
+ <dfn><color-stripe></dfn> = <<color>> && [ <<length-percentage>> | <<flex>> ]?
1922
+ </pre>
1923
+
1924
+ The ''stripes()'' function defines a 1d-image
1925
+ as a number of colored stripes with different widths.
1926
+
1927
+ Each comma-separated entry defines a solid-color stripe,
1928
+ each placed end-to-end on the [=paint line=] in the order given,
1929
+ with the specified <<color>> and thickness.
1930
+ If the thickness is omitted,
1931
+ it defaults to ''1fr'' .
1932
+
1933
+ In each entry, a <<percentage>> is relative to the |painting area|
1934
+ and must be between ''0%'' and ''100%'' inclusive
1935
+ or else the function is invalid.
1936
+ A <<flex>> is evaluated as a fraction of the |painting area|
1937
+ relative to the total sum of <<flex>> entries in the function,
1938
+ after subtracting the thickness of any non-<<flex>> entries
1939
+ (flooring the subtraction result at zero).
1940
+ If the sum of <<flex>> values is less than 1fr,
1941
+ the result of the subtraction is multiplied by the sum's value
1942
+ before being distributed.
1943
+
1944
+ <div class=example>
1945
+ For example,
1946
+ ''stripes(red 1fr, green 2fr, blue 100px)``
1947
+ with a |painting area| of '' 400px''
1948
+ will result in a 100px red stripe and 200px green stripe,
1949
+ giving red 1 share and green 2 shares of the 300px remaining
1950
+ after subtracting blue's 100px from the 400px total.
1951
+
1952
+ On the other hand,
1953
+ '' stripes(red .1fr, green .2fr, blue 100px)``
1954
+ with a |painting area| of ''400px''
1955
+ will instead give a 30px red stripe and 60px green stripe,
1956
+ followed by 100px of blue and then 210px of transparent.
1957
+ The 300px of leftover space is multiplied by .3,
1958
+ the value of the sum of the <<flex>> values,
1959
+ to obtain only 90px,
1960
+ which is then distributed in the 1:2 ratio
1961
+ the <<flex>> values would dictate.
1962
+
1963
+ (This is similar to how [=flex layout=] deals with small <<flex>> sums on a line,
1964
+ and ensures smoothly continuous behavior
1965
+ as the <<flex>> values approach zero.)
1966
+ </div>
1967
+
1968
+ The |painting area| is defined by the context in which the ''stripes()'' function is used.
1969
+ If used generically as an <<image>> ,
1970
+ the |painting area| is the height of the [=concrete image size=] .
1971
+
1972
+ If the sum thickness of the stripes is smaller than the |painting area|,
1973
+ the [=paint line=] is [=transparent black=] for its remaining length,
1974
+ as if a final ''transparent'' argument were given.
1975
+ If the sum thickness is larger,
1976
+ any stripes or portions thereof that would be past the end of the [=paint line=] have no effect.
1977
+
1978
+ The computed value of this function is the [=specified value=]
1979
+ with all <<color>> s computed
1980
+ and all <<length-percentage>> s absolutized and computed to the extent possible.
1909
1981
1910
1982
<!--
1911
1983
██████ ████ ████████ ████ ██ ██ ██████
@@ -2393,6 +2465,39 @@ Interpolating <<gradient>> {#interpolating-gradients}
2393
2465
Then, for each pair of color-stops,
2394
2466
interpolate the position and color independently.
2395
2467
2468
+ Interpolating <<1d-image>> {#interpolating-1d-images}
2469
+ -----------------------------------------------
2470
+
2471
+ Similar to <a lt="interpolating-gradients">gradient images</a> ,
2472
+ one-dimensional images can be interpolated directly in CSS transitions and animations,
2473
+ smoothly animating from one image to another.
2474
+ There are only a few restrictions on what images are allowed to be interpolated:
2475
+
2476
+ 1. Both the starting and ending image must have the same number of <<color-stripe>> s.
2477
+
2478
+ 2. Neither image uses a combination of <<length>> , <<percentage>> , and <<flex>> stripes.
2479
+
2480
+ If the two image satisfy both constraints,
2481
+ they must be interpolated as described below.
2482
+ If they fail the second one only,
2483
+ they must be abruptly transitioned at 50%
2484
+ (unless otherwise specified by a future specification).
2485
+ If they fail the first constraint,
2486
+ they must be interpolated using ''cross-fade()''
2487
+ as for generic images.
2488
+
2489
+ Note: The abrupt transition at 50% is so that content will not rely on cross-fading,
2490
+ and smarter interpolation rules can be added for this case in the future.
2491
+
2492
+ 1. Interpolate each component and stripe of the images independently.
2493
+
2494
+ 2. To interpolate a stripe,
2495
+ first match each stripe in the start image
2496
+ to the corresponding stripe at the same index in the end image.
2497
+ Then, for each pair of stripes,
2498
+ interpolate the <a href="https://www.w3.org/TR/css3-transitions/#animtype-length">thickness</a>
2499
+ and <a href="https://www.w3.org/TR/css3-transitions/#animtype-color">color</a> independently.
2500
+
2396
2501
<!--
2397
2502
██████ ████████ ████████ ████ ███ ██ ████ ████████ ███ ████████ ████ ███████ ██ ██
2398
2503
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██
@@ -2471,7 +2576,7 @@ Changes {#changes}
2471
2576
- Switched color-stop grammar to repeat at end for readability
2472
2577
- Clarified that object-fit and image-resolution use discrete animation
2473
2578
- Fixed definition of cross-fade() image blending
2474
- - Added placeholder section for the stripes() function
2579
+ - Added <1d-image> data type and stripes() function and added &1d-image> to <image> data type
2475
2580
- Moved interpolation of images from [[css3-images]]
2476
2581
- Clarifed that cross-fade() takes 1+ arguments. Defined sizing and painting of the new function arguments in detail.
2477
2582
- Moved cross-fade() from [[css3-images]]
0 commit comments