| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| .parent { |
| perspective: 30px; |
| } |
| .target { |
| display: inline-block; |
| margin-top: 50px; |
| margin-bottom: 25px; |
| perspective: 10px; |
| } |
| .transformed { |
| width: 50px; |
| height: 50px; |
| background: black; |
| transform: rotateY(45deg); |
| } |
| .expected .transformed { |
| background: green; |
| } |
| .expected { |
| position: relative; |
| left: -50px; |
| opacity: 0.75; |
| } |
| </style> |
| <body> |
| <template id="target-template"> |
| <div><div class="transformed"></div></div> |
| </template> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| assertInterpolation({ |
| property: 'perspective', |
| from: neutralKeyframe, |
| to: '20px', |
| }, [ |
| {at: -20, is: 'none'}, |
| {at: -1, is: 'none'}, |
| {at: -0.3, is: '7px'}, |
| {at: 0, is: '10px'}, |
| {at: 0.3, is: '13px'}, |
| {at: 0.6, is: '16px'}, |
| {at: 1, is: '20px'}, |
| {at: 1.5, is: '25px'}, |
| ]); |
| |
| assertNoInterpolation({ |
| property: 'perspective', |
| from: 'initial', |
| to: '20px', |
| }); |
| |
| assertInterpolation({ |
| property: 'perspective', |
| from: 'inherit', |
| to: '20px', |
| }, [ |
| {at: -20, is: '230px'}, |
| {at: -1, is: '40px'}, |
| {at: -0.3, is: '33px'}, |
| {at: 0, is: '30px'}, |
| {at: 0.3, is: '27px'}, |
| {at: 0.6, is: '24px'}, |
| {at: 1, is: '20px'}, |
| {at: 1.5, is: '15px'}, |
| ]); |
| |
| assertNoInterpolation({ |
| property: 'perspective', |
| from: 'unset', |
| to: '20px', |
| }); |
| |
| assertInterpolation({ |
| property: 'perspective', |
| from: '50px', |
| to: '100px', |
| }, [ |
| {at: -20, is: 'none'}, // perspective does not accept 0 or negative values |
| {at: -1, is: 'none'}, // perspective does not accept 0 or negative values |
| {at: -0.3, is: '35px'}, |
| {at: 0, is: '50px'}, |
| {at: 0.3, is: '65px'}, |
| {at: 0.6, is: '80px'}, |
| {at: 1, is: '100px'}, |
| {at: 1.5, is: '125px'}, |
| ]); |
| |
| assertNoInterpolation({ |
| property: 'perspective', |
| from: '50px', |
| to: 'none', |
| }); |
| </script> |
| </body> |