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-position: 30px 10px; |
6 } | 6 } |
7 .target { | 7 .target { |
8 display: inline-block; | 8 offset-position: 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-position', |
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 assertNoInterpolation({ |
50 property: 'perspective-origin', | 31 property: 'offset-position', |
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'}, | |
55 {at: 0, is: '25px 25px'}, | |
56 {at: 0.3, is: '23.5px 23.5px'}, | |
57 {at: 0.6, is: '22px 22px'}, | |
58 {at: 1, is: '20px 20px'}, | |
59 {at: 1.5, is: '17.5px 17.5px'}, | |
60 ]); | |
61 | 35 |
62 assertInterpolation({ | 36 assertInterpolation({ |
63 property: 'perspective-origin', | 37 property: 'offset-position', |
64 from: 'inherit', | 38 from: 'inherit', |
65 to: '20px 20px', | 39 to: '20px 20px', |
66 }, [ | 40 }, [ |
67 {at: -0.3, is: '33px 7px'}, | 41 {at: -0.3, is: '33px 7px'}, |
68 {at: 0, is: '30px 10px'}, | 42 {at: 0, is: '30px 10px'}, |
69 {at: 0.3, is: '27px 13px'}, | 43 {at: 0.3, is: '27px 13px'}, |
70 {at: 0.6, is: '24px 16px'}, | 44 {at: 0.6, is: '24px 16px'}, |
71 {at: 1, is: '20px 20px'}, | 45 {at: 1, is: '20px 20px'}, |
72 {at: 1.5, is: '15px 25px'}, | 46 {at: 1.5, is: '15px 25px'}, |
73 ]); | 47 ]); |
74 | 48 |
75 assertInterpolation({ | 49 assertNoInterpolation({ |
76 property: 'perspective-origin', | 50 property: 'offset-position', |
77 from: 'unset', | 51 from: 'unset', |
78 to: '20px 20px', | 52 to: '20px 20px', |
79 }, [ | 53 }); |
80 {at: -0.3, is: '26.5px 26.5px'}, | |
81 {at: 0, is: '25px 25px'}, | |
82 {at: 0.3, is: '23.5px 23.5px'}, | |
83 {at: 0.6, is: '22px 22px'}, | |
84 {at: 1, is: '20px 20px'}, | |
85 {at: 1.5, is: '17.5px 17.5px'}, | |
86 ]); | |
87 | 54 |
88 assertInterpolation({ | 55 assertInterpolation({ |
89 property: 'perspective-origin', | 56 property: 'offset-position', |
90 from: '0% 50%', | 57 from: '0% 50%', |
91 to: '100% 150%' | 58 to: '100% 150%' |
92 }, [ | 59 }, [ |
93 {at: -0.3, is: '-30% 20%'}, | 60 {at: -0.3, is: '-30% 20%'}, |
94 {at: 0, is: '0% 50%'}, | 61 {at: 0, is: '0% 50%'}, |
95 {at: 0.3, is: '30% 80%'}, | 62 {at: 0.3, is: '30% 80%'}, |
96 {at: 0.6, is: '60% 110%'}, | 63 {at: 0.6, is: '60% 110%'}, |
97 {at: 1, is: '100% 150%'}, | 64 {at: 1, is: '100% 150%'}, |
98 {at: 1.5, is: '150% 200%'} | 65 {at: 1.5, is: '150% 200%'} |
99 ]); | 66 ]); |
| 67 |
| 68 assertNoInterpolation({ |
| 69 property: 'offset-position', |
| 70 from: 'auto', |
| 71 to: '20px 20px', |
| 72 }); |
100 </script> | 73 </script> |
101 </body> | 74 </body> |
OLD | NEW |