summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-view-transitions/3d-transform-incoming.html
blob: d852108ffa484553ba3d8ed63141df7d751b7ba2 (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
65
<!DOCTYPE html>
<html class=reftest-wait>
<title>Shared transitions: 3d transform</title>
<link rel="help" href="https://github.com/WICG/view-transitions">
<link rel="author" href="mailto:vmpstr@chromium.org">
<link rel="match" href="3d-transform-incoming-ref.html">
<meta name=fuzzy content="3d-transform-incoming-ref.html:0-80;0-500">
<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;
  contain: layout;
  width: 100px;
  height: 100px;
}
#hidden {
  view-transition-name: hidden;
  width: 10px;
  height: 10px;
  background: red;
  contain: layout;
}

::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-delay: 300s; }
::view-transition-new(*) { animation: unset; opacity: 1; }
::view-transition-old(*) { animation: unset; opacity: 0; }
</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>