OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
3 <style> | 3 <style> |
4 .parent { | 4 .parent { |
5 perspective-origin: 30px 10px; | 5 offset-anchor: 30px 10px; |
6 } | 6 } |
7 .target { | 7 .target { |
8 display: inline-block; | 8 offset-anchor: 10px 30px; |
9 -webkit-perspective: 50; | |
10 perspective: 50; | |
11 margin-top: 50px; | |
12 margin-bottom: 25px; | |
13 perspective-origin: 10px 30px; | |
14 } | |
15 .transformed { | |
16 width: 50px; | |
17 height: 50px; | |
18 background: black; | |
19 transform: rotateY(45deg); | |
20 } | |
21 .expected .transformed { | |
22 background: green; | |
23 } | |
24 .expected { | |
25 position: relative; | |
26 left: -50px; | |
27 opacity: 0.75; | |
28 } | 9 } |
29 </style> | 10 </style> |
30 <body> | 11 <body> |
31 <template id="target-template"> | 12 <template id="target-template"> |
32 <div><div class="transformed"></div></div> | 13 <div><div class="transformed"></div></div> |
33 </template> | 14 </template> |
34 <script src="resources/interpolation-test.js"></script> | 15 <script src="resources/interpolation-test.js"></script> |
35 <script> | 16 <script> |
36 assertInterpolation({ | 17 assertInterpolation({ |
37 property: 'perspective-origin', | 18 property: 'offset-anchor', |
38 from: neutralKeyframe, | 19 from: neutralKeyframe, |
39 to: '20px 20px', | 20 to: '20px 20px', |
40 }, [ | 21 }, [ |
41 {at: -0.3, is: '7px 33px'}, | 22 {at: -0.3, is: '7px 33px'}, |
42 {at: 0, is: '10px 30px'}, | 23 {at: 0, is: '10px 30px'}, |
43 {at: 0.3, is: '13px 27px'}, | 24 {at: 0.3, is: '13px 27px'}, |
44 {at: 0.6, is: '16px 24px'}, | 25 {at: 0.6, is: '16px 24px'}, |
45 {at: 1, is: '20px 20px'}, | 26 {at: 1, is: '20px 20px'}, |
46 {at: 1.5, is: '25px 15px'}, | 27 {at: 1.5, is: '25px 15px'}, |
47 ]); | 28 ]); |
48 | 29 |
49 assertInterpolation({ | 30 assertInterpolation({ |
50 property: 'perspective-origin', | 31 property: 'offset-anchor', |
51 from: 'initial', | 32 from: 'initial', |
52 to: '20px 20px', | 33 to: '20px 20px', |
53 }, [ | 34 }, [ |
54 {at: -0.3, is: '26.5px 26.5px'}, | 35 {at: -0.3, is: 'auto'}, |
55 {at: 0, is: '25px 25px'}, | 36 {at: 0, is: 'auto'}, |
56 {at: 0.3, is: '23.5px 23.5px'}, | 37 {at: 0.3, is: 'auto'}, |
57 {at: 0.6, is: '22px 22px'}, | 38 {at: 0.6, is: '20px 20px'}, |
58 {at: 1, is: '20px 20px'}, | 39 {at: 1, is: '20px 20px'}, |
59 {at: 1.5, is: '17.5px 17.5px'}, | 40 {at: 1.5, is: '20px 20px'}, |
60 ]); | 41 ]); |
61 | 42 |
62 assertInterpolation({ | 43 assertInterpolation({ |
63 property: 'perspective-origin', | 44 property: 'offset-anchor', |
64 from: 'inherit', | 45 from: 'inherit', |
65 to: '20px 20px', | 46 to: '20px 20px', |
66 }, [ | 47 }, [ |
67 {at: -0.3, is: '33px 7px'}, | 48 {at: -0.3, is: '33px 7px'}, |
68 {at: 0, is: '30px 10px'}, | 49 {at: 0, is: '30px 10px'}, |
69 {at: 0.3, is: '27px 13px'}, | 50 {at: 0.3, is: '27px 13px'}, |
70 {at: 0.6, is: '24px 16px'}, | 51 {at: 0.6, is: '24px 16px'}, |
71 {at: 1, is: '20px 20px'}, | 52 {at: 1, is: '20px 20px'}, |
72 {at: 1.5, is: '15px 25px'}, | 53 {at: 1.5, is: '15px 25px'}, |
73 ]); | 54 ]); |
74 | 55 |
75 assertInterpolation({ | 56 assertInterpolation({ |
76 property: 'perspective-origin', | 57 property: 'offset-anchor', |
77 from: 'unset', | 58 from: 'unset', |
78 to: '20px 20px', | 59 to: '20px 20px', |
79 }, [ | 60 }, [ |
80 {at: -0.3, is: '26.5px 26.5px'}, | 61 {at: -0.3, is: 'auto'}, |
81 {at: 0, is: '25px 25px'}, | 62 {at: 0, is: 'auto'}, |
82 {at: 0.3, is: '23.5px 23.5px'}, | 63 {at: 0.3, is: 'auto'}, |
83 {at: 0.6, is: '22px 22px'}, | 64 {at: 0.6, is: '20px 20px'}, |
84 {at: 1, is: '20px 20px'}, | 65 {at: 1, is: '20px 20px'}, |
85 {at: 1.5, is: '17.5px 17.5px'}, | 66 {at: 1.5, is: '20px 20px'}, |
86 ]); | 67 ]); |
87 | 68 |
88 assertInterpolation({ | 69 assertInterpolation({ |
89 property: 'perspective-origin', | 70 property: 'offset-anchor', |
90 from: '0% 50%', | 71 from: '0% 50%', |
91 to: '100% 150%' | 72 to: '100% 150%' |
92 }, [ | 73 }, [ |
93 {at: -0.3, is: '-30% 20%'}, | 74 {at: -0.3, is: '-30% 20%'}, |
94 {at: 0, is: '0% 50%'}, | 75 {at: 0, is: '0% 50%'}, |
95 {at: 0.3, is: '30% 80%'}, | 76 {at: 0.3, is: '30% 80%'}, |
96 {at: 0.6, is: '60% 110%'}, | 77 {at: 0.6, is: '60% 110%'}, |
97 {at: 1, is: '100% 150%'}, | 78 {at: 1, is: '100% 150%'}, |
98 {at: 1.5, is: '150% 200%'} | 79 {at: 1.5, is: '150% 200%'} |
99 ]); | 80 ]); |
| 81 |
| 82 assertInterpolation({ |
| 83 property: 'offset-anchor', |
| 84 from: 'auto', |
| 85 to: '20px 20px', |
| 86 }, [ |
| 87 {at: -0.3, is: 'auto'}, |
| 88 {at: 0, is: 'auto'}, |
| 89 {at: 0.3, is: 'auto'}, |
| 90 {at: 0.6, is: '20px 20px'}, |
| 91 {at: 1, is: '20px 20px'}, |
| 92 {at: 1.5, is: '20px 20px'}, |
| 93 ]); |
100 </script> | 94 </script> |
101 </body> | 95 </body> |
OLD | NEW |