Skip to content

Commit 3db2912

Browse files
authored
Use keyframes to specify plus-lighter blending for cross-fades (#9000)
* Use keyframes to specify plus-lighter blending for cross-fades * Fix indentation
1 parent 745fde5 commit 3db2912

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -837,11 +837,11 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
837837
@keyframes -ua-view-transition-fade-in {
838838
from { opacity: 0; }
839839
}
840-
:root::view-transition-old(*) {
841-
animation-name: -ua-view-transition-fade-out;
842-
}
843-
:root::view-transition-new(*) {
844-
animation-name: -ua-view-transition-fade-in;
840+
841+
/* Keyframes for blending when there are 2 images */
842+
@keyframes -ua-mix-blend-mode-plus-lighter {
843+
from { mix-blend-mode: plus-lighter }
844+
to { mix-blend-mode: plus-lighter }
845845
}
846846
```
847847

@@ -1143,7 +1143,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
11431143
: <dfn>image pair isolation rule</dfn>
11441144
:: A {{CSSStyleRule}} or null. Initially null.
11451145

1146-
: <dfn>view blend mode rule</dfn>
1146+
: <dfn>image animation name rule</dfn>
11471147
:: A {{CSSStyleRule}} or null. Initially null.
11481148
</dl>
11491149

@@ -1420,6 +1420,36 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14201420
are not painted (as if they had ''visibility: hidden'')
14211421
and do not respond to hit-testing (as if they had pointer-events: none) until |new| exists.
14221422

1423+
1. If |capturedElement|'s [=captured element/old image=] is null, then:
1424+
1. [=Assert=]: |capturedElement|'s [=captured element/new element=] is not null.
1425+
1426+
1. Set |capturedElement|'s [=captured element/image animation name rule=] to a new {{CSSStyleRule}} representing the following CSS,
1427+
and append it to |document|'s [=document/dynamic view transition style sheet=]:
1428+
1429+
<!-- deliberately using <pre> so the example can contain <var> references -->
1430+
<pre highlight="css">
1431+
:root::view-transition-new(<var>transitionName</var>) {
1432+
animation-name: -ua-view-transition-fade-in;
1433+
}
1434+
</pre>
1435+
1436+
Note: The above code example contains variables to be replaced.
1437+
1438+
1. If |capturedElement|'s [=captured element/new element=] is null, then:
1439+
1. [=Assert=]: |capturedElement|'s [=captured element/old image=] is not null.
1440+
1441+
1. Set |capturedElement|'s [=captured element/image animation name rule=] to a new {{CSSStyleRule}} representing the following CSS,
1442+
and append it to |document|'s [=document/dynamic view transition style sheet=]:
1443+
1444+
<!-- deliberately using <pre> so the example can contain <var> references -->
1445+
<pre highlight="css">
1446+
:root::view-transition-old(<var>transitionName</var>) {
1447+
animation-name: -ua-view-transition-fade-out;
1448+
}
1449+
</pre>
1450+
1451+
Note: The above code example contains variables to be replaced.
1452+
14231453
1. If both of |capturedElement|'s [=captured element/old image=] and [=captured element/new element=]
14241454
are not null, then:
14251455

@@ -1469,14 +1499,16 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14691499

14701500
Note: The above code example contains variables to be replaced.
14711501

1472-
1. Set |capturedElement|'s [=captured element/view blend mode rule=] to a new {{CSSStyleRule}} representing the following CSS,
1502+
1. Set |capturedElement|'s [=captured element/image animation name rule=] to a new {{CSSStyleRule}} representing the following CSS,
14731503
and append it to |document|'s [=document/dynamic view transition style sheet=]:
14741504

14751505
<!-- deliberately using <pre> so the example can contain <var> references -->
14761506
<pre highlight="css">
1477-
:root::view-transition-old(<var>transitionName</var>),
1507+
:root::view-transition-old(<var>transitionName</var>) {
1508+
animation-name: -ua-view-transition-fade-out, -ua-mix-blend-mode-plus-lighter;
1509+
}
14781510
:root::view-transition-new(<var>transitionName</var>) {
1479-
mix-blend-mode: plus-lighter;
1511+
animation-name: -ua-view-transition-fade-in, -ua-mix-blend-mode-plus-lighter;
14801512
}
14811513
</pre>
14821514

@@ -1789,6 +1821,11 @@ This should be feasible since access to this data should already be prevented in
17891821

17901822
This appendix is <em>informative</em>.
17911823

1824+
<h3 id="changes-since-2022-05-30">
1825+
Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230530/">2022-05-30 Working Draft</a>
1826+
</h3>
1827+
* Use a keyframe to add plus-lighter blending during cross-fade. See <a href="https://github.com/w3c/csswg-drafts/issues/8924">issue 8924</a>.
1828+
17921829
<h3 id="changes-since-2022-05-25">
17931830
Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230525/">2022-05-25 Working Draft</a>
17941831
</h3>

0 commit comments

Comments
 (0)