summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-view-transitions/3d-transform-outgoing.html
blob: 398fa97ca99bc07e12f31179083c7321099041ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: 3d transform</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
<link rel="author" href="mailto:vmpstr@chromium.org">
<link rel="match" href="3d-transform-outgoing-ref.html">
<meta name=fuzzy content="3d-transform-outgoing-ref.html:0-255;0-1200">
<script src="/common/reftest-wait.js"></script>

<style>
div { box-sizing: border-box; will-change: transform }
.rotate3d {
  transform: translate(20px, 100px) rotate3d(1, 1, 1, 45deg);
  background: blue;
}

.wrap_perspective {
  perspective: 100px;
  width: max-content;
  transform: translate(200px);
}
.rotatex {
  transform-style: preserve-3d;
  transform: rotateX(20deg);
  background: green;
}
.shared {
  view-transition-name: shared;
  width: 100px;
  height: 100px;
}
#hidden {
  view-transition-name: hidden;
  width: 10px;
  height: 10px;
  background: red;
}

::view-transition-group(hidden) { animation-duration: 300s; }
::view-transition-image-pair(hidden) { visibility: hidden; }
::view-transition-group(root) { visibility: hidden; }
::view-transition { background: pink; }
::view-transition-group(*) { animation-duration: 0s; }
::view-transition-new(*) { animation: unset; opacity: 0; }
::view-transition-old(*) { animation: unset; opacity: 1; }
</style>

<div id=wrapper class=wrap_perspective><div id=target class="shared rotatex"></div></div>
<div id=hidden></div>

<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");

function runTest() {
  document.startViewTransition(() => {
    wrapper.classList.toggle("wrap_perspective");
    target.classList.toggle("rotatex");
    target.classList.toggle("rotate3d");
    requestAnimationFrame(() => requestAnimationFrame(takeScreenshot));
  });
}

onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>