| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| .parent { |
| object-position: 30px 10px; |
| } |
| .target { |
| position: relative; |
| width: 100px; |
| height: 100px; |
| background-color: black; |
| display: inline-block; |
| margin: 20px 0px 20px 0px; |
| object-fit: fill; |
| object-position: 10px 30px; |
| } |
| .expected { |
| background-color: green; |
| } |
| </style> |
| <body> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| assertInterpolation({ |
| property: 'object-position', |
| from: neutralKeyframe, |
| to: '20px 20px', |
| }, [ |
| {at: -0.3, is: '7px 33px'}, |
| {at: 0, is: '10px 30px'}, |
| {at: 0.5, is: '15px 25px'}, |
| {at: 1, is: '20px 20px'}, |
| {at: 1.5, is: '25px 15px'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: 'initial', |
| to: '20px 20px', |
| }, [ |
| {at: -0.3, is: 'calc(-6px + 65%) calc(-6px + 65%)'}, |
| {at: 0, is: '50% 50%'}, |
| {at: 0.5, is: 'calc(10px + 25%) calc(10px + 25%)'}, |
| {at: 1, is: '20px 20px'}, |
| {at: 1.5, is: 'calc(30px + -25%) calc(30px + -25%)'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: 'inherit', |
| to: '20px 20px', |
| }, [ |
| {at: -0.3, is: '33px 7px'}, |
| {at: 0, is: '30px 10px'}, |
| {at: 0.5, is: '25px 15px'}, |
| {at: 1, is: '20px 20px'}, |
| {at: 1.5, is: '15px 25px'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: 'unset', |
| to: '20px 20px', |
| }, [ |
| {at: -0.3, is: 'calc(-6px + 65%) calc(-6px + 65%)'}, |
| {at: 0, is: '50% 50%'}, |
| {at: 0.5, is: 'calc(10px + 25%) calc(10px + 25%)'}, |
| {at: 1, is: '20px 20px'}, |
| {at: 1.5, is: 'calc(30px + -25%) calc(30px + -25%)'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: '50% 50%', |
| to: '100% 100%' |
| }, [ |
| {at: -0.3, is: '35% 35%'}, |
| {at: 0, is: '50% 50%'}, |
| {at: 0.5, is: '75% 75%'}, |
| {at: 1, is: '100% 100%'}, |
| {at: 1.5, is: '125% 125%'} |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: '100px 200px', |
| to: '0px 0px' |
| }, [ |
| {at: -0.3, is: '130px 260px'}, |
| {at: 0, is: '100px 200px'}, |
| {at: 0.5, is: '50px 100px'}, |
| {at: 1, is: '0px 0px'}, |
| {at: 1.5, is: '-50px -100px'} |
| ]); |
| |
| // Zero seem to be a special case in the old implementation |
| assertInterpolation({ |
| property: 'object-position', |
| from: '50% 100%', |
| to: '0px 0px' |
| }, [ |
| {at: -0.3, is: '65% 130%'}, |
| {at: 0, is: '50% 100%'}, |
| {at: 0.5, is: '25% 50%'}, |
| {at: 1, is: '0px 0px'}, |
| {at: 1.5, is: '-25% -50%'} |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: '50% 100%', |
| to: '50px 100px' |
| }, [ |
| {at: -0.3, is: 'calc(65% + -15px) calc(130% + -30px)'}, |
| {at: 0, is: '50% 100%'}, |
| {at: 0.5, is: 'calc(25% + 25px) calc(50% + 50px)'}, |
| {at: 1, is: '50px 100px'}, |
| {at: 1.5, is: 'calc(-25% + 75px) calc(-50% + 150px)'} |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: 'center', |
| to: 'top right' |
| }, [ |
| {at: -0.3, is: '35% 65%'}, |
| {at: 0, is: '50% 50%'}, |
| {at: 0.5, is: '75% 25%'}, |
| {at: 1, is: '100% 0%'}, |
| {at: 1.5, is: '125% -25%'} |
| ]); |
| |
| assertInterpolation({ |
| property: 'object-position', |
| from: 'center', |
| to: 'right 0% bottom 50%', |
| }, [ |
| {at: -0.5, is: '25% 50%'}, |
| {at: 0, is: 'center'}, |
| {at: 0.3, is: '65% 50%'}, |
| {at: 0.5, is: '75% 50%'}, |
| {at: 0.9, is: '95% 50%'}, |
| {at: 1, is: '100% 50%'}, |
| {at: 1.5, is: '125% 50%'}, |
| {at: 2, is: '150% 50%'}, |
| ]); |
| </script> |
| </body> |