summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-transforms/preserve3d-and-filter-no-perspective.html
blob: 0145b0dbfd24326e23a32e85064913f9f9393491 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE HTML>
<title>CSS Test (Transforms): Filter on an element in a preserve-3d scene</title>
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<link rel="author" title="Google" href="http://www.google.com/">
<link rel="help" href="http://www.w3.org/TR/css-transforms-2/#3d-transform-rendering">
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#FilterProperty">
<meta name="assert" content="The filtered element is rendered correctly without clipping, despite the interesting transform.">
<link rel="match" href="preserve3d-and-filter-no-perspective-ref.html">

<style>

  .scene {
    width: 400px;
    height: 400px;
    position: absolute;
    left: 100px;
    top: 100px;
  }

  .chair {
    width: 400px;
    height: 400px;
    transform: rotateY(80deg);
    transform-style: preserve-3d;
    transform-origin: 50% 50% 50%;
  }

  .shadow {
    position: absolute;
    top: 250px;
    left: 0;
    width: 200px;
    height: 200px;
    filter: blur(1px);
    background: black;
    transform: translate3d(1px, 1px, 1px);
  }

  svg.cover {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 500px;
    height: 570px;
  }

</style>

<!--

The overall transform here from the viewport to the
<div class="shadow"></div> is:

translate(100px, 100px) translate(200px, 200px) rotateY(80deg) translate(-200px, -200px) translateY(250px) translate(100px, 100px) translate3d(1px, 1px, 1px) translate(-100px, -100px)

which according to https://codepen.io/milosdjakonovic/pen/QyqJyp
is equivalent to the matrix:

matrix3d(0.173648, 0, -0.984808, 0,
         0, 1, 0, 0,
         0.984808, 0, 0.173648, 0,
         266.429, 351, 196.15, 1)

[ 0.173648 0 0.984808 266.429 ]
[ 0 1 0 351 ]
[ -0.984808 0 0.173648 196.15 ]
[ 0 0 0 1 ]

-->

<div class="scene">
 <div class="chair">
  <div class="shadow"></div>
 </div>
</div>

<!-- cover the blurred edge so we can match to a reference -->
<svg class="cover">
  <polygon fill="transparent" stroke="blue" stroke-width="8"
           points="266.429,351
                   301.1586,351
                   301.1586,551
                   266.429,551" />
</svg>