Skip to content

Commit 1b610f7

Browse files
committed
Incorporated fantasai's comments on stripes() and `<1d-image>
1 parent a49e0a2 commit 1b610f7

File tree

3 files changed

+44
-22
lines changed

3 files changed

+44
-22
lines changed

css-backgrounds-4/Overview.bs

+4-15
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,12 @@ Painting Area: the 'background-clip' property</h3>
202202
These properties set the foreground color of the border specified
203203
by the 'border-style' properties.
204204

205-
The stripes defined by <<1d-image>> follow the direction of
206-
the side the border is applied on (i.e. horizontally on left and
207-
right borders and vertically on top and bottom borders), starting outwards.
205+
The stripes defined by <<1d-image>> follow the shape of the border
206+
on the side to which they apply,
207+
and are drawn in bands starting from the [=padding edge=] and progressing outwards.
208208
With that, the corresponding 'border-*-width' property defines the total
209209
width of the stripes.
210210

211-
The stripes are painted above a given <<color>>. This allows the <<color>>
212-
value to serve as a fallback, so any transparent stripes let the color
213-
shine through.
214-
215-
When interpolating between borders with the same number of colors,
216-
interpolation is performed individually per color band as <a href="https://www.w3.org/TR/css3-transitions/#animtype-color">color</a>.
217-
Interpolation between borders with different numbers of colors is discrete.
218-
219211
'border-color' is a shorthand for the four 'border-*-color' properties.
220212
The four values set the top, right, bottom and left border, respectively.
221213
A missing left is the same as right,
@@ -229,10 +221,7 @@ Painting Area: the 'background-clip' property</h3>
229221
<pre class=lang-css>
230222
.foo {
231223
border: 30px solid;
232-
border-top-color: stripes(skyblue, black);
233-
border-right-color: stripes(orange, yellow);
234-
border-bottom-color: stripes(yellowgreen, black);
235-
border-left-color: stripes(indianred, yellow);
224+
border-color: stripes(skyblue, black) stripes(orange, yellow) stripes(yellowgreen, black) stripes(indianred, yellow);
236225
}
237226
</pre>
238227

css-images-4/Overview.bs

+38-5
Original file line numberDiff line numberDiff line change
@@ -1923,7 +1923,8 @@ Color Stop “Fixup”</h4>
19231923

19241924
<pre class=prod>
19251925
<dfn>&lt;1d-image></dfn> = <<stripes()>>
1926-
<dfn>stripes()</dfn> = stripes( [ <<color>> && [ <<length-percentage>> | <<flex>>]? ]# )
1926+
<dfn>stripes()</dfn> = stripes( <<color-stripe>># )
1927+
<dfn>&lt;color-stripe></dfn> = <<color>> && [ <<length-percentage>> | <<flex>> ]?
19271928
</pre>
19281929

19291930
The ''stripes()'' function defines a 1d-image
@@ -1969,19 +1970,18 @@ Color Stop “Fixup”</h4>
19691970
and ensures smoothly continuous behavior
19701971
as the <<flex>> values approach zero.)
19711972
</div>
1972-
1973-
1973+
19741974
The |painting area| is defined by the context in which the ''stripes()'' function is used.
19751975
If used generically as an <<image>>,
19761976
the |painting area| is the height of the [=concrete image size=].
1977-
1977+
19781978
If the sum thickness of the stripes is smaller than the |painting area|,
19791979
the [=paint line=] is [=transparent black=] for its remaining length,
19801980
as if a final ''transparent'' argument were given.
19811981
If the sum thickness is larger,
19821982
any stripes or portions thereof that would be past the end of the [=paint line=] have no effect.
19831983

1984-
The computed value of this function is the [=specified value=]
1984+
The computed value of this function is the [=specified value=]
19851985
with all <<color>>s computed
19861986
and all <<length-percentage>>s absolutized and computed to the extent possible.
19871987

@@ -2471,6 +2471,39 @@ Interpolating <<gradient>> {#interpolating-gradients}
24712471
Then, for each pair of color-stops,
24722472
interpolate the position and color independently.
24732473

2474+
Interpolating <<1d-image>> {#interpolating-1d-images}
2475+
-----------------------------------------------
2476+
2477+
Similar to <a lt="interpolating-gradients">gradient images</a>,
2478+
one-dimensional images can be interpolated directly in CSS transitions and animations,
2479+
smoothly animating from one image to another.
2480+
There are only a few restrictions on what images are allowed to be interpolated:
2481+
2482+
1. Both the starting and ending image must have the same number of <<color-stripe>>s.
2483+
2484+
2. Neither image uses a combination of <<length>>, <<percentage>>, and <<flex>> stripes.
2485+
2486+
If the two image satisfy both constraints,
2487+
they must be interpolated as described below.
2488+
If they fail the second one only,
2489+
they must be abruptly transitioned at 50%
2490+
(unless otherwise specified by a future specification).
2491+
If they fail the first constraint,
2492+
they must be interpolated using ''cross-fade()''
2493+
as for generic images.
2494+
2495+
Note: The abrupt transition at 50% is so that content will not rely on cross-fading,
2496+
and smarter interpolation rules can be added for this case in the future.
2497+
2498+
1. Interpolate each component and stripe of the images independently.
2499+
2500+
2. To interpolate a stripe,
2501+
first match each stripe in the start image
2502+
to the corresponding stripe at the same index in the end image.
2503+
Then, for each pair of stripes,
2504+
interpolate the <a href="https://www.w3.org/TR/css3-transitions/#animtype-length">thickness</a>
2505+
and <a href="https://www.w3.org/TR/css3-transitions/#animtype-color">color</a> independently.
2506+
24742507
<!--
24752508
██████ ████████ ████████ ████ ███ ██ ████ ████████ ███ ████████ ████ ███████ ██ ██
24762509
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██

css-ui-4/Overview.bs

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ Inherited: no
294294
Percentages: N/A
295295
Computed value: The computed value for ''outline-color/invert'' is ''outline-color/invert''.
296296
For <<color>> values, see [[!CSS-COLOR-4#resolving-color-values]] in [[!CSS-COLOR-4]].
297-
<<1d-image>> values are computed as defined in their definition.
297+
For <<1d-image>> values, see [[!CSS-IMAGES-4#stripes]] in [[!CSS-IMAGES-4]].
298298
Animation type: by computed value
299299
</pre>
300300

@@ -753,7 +753,7 @@ Values have the following meanings:
753753

754754
Note: This specification does not define
755755
how the coordinate systems of the various types of <<image>> are established,
756-
and defers these definitions to [[CSS4-IMAGES]].
756+
and defers these definitions to [[CSS-IMAGES-4]].
757757

758758
If the values are unspecified,
759759
then the natural hotspot defined inside the image resource itself is used.

0 commit comments

Comments
 (0)