| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| .parent { |
| offset-rotate: 30deg; |
| } |
| .target { |
| width: 80px; |
| height: 80px; |
| display: inline-block; |
| background-color: black; |
| margin-right: 5px; |
| offset-rotate: 10deg; |
| } |
| .expected { |
| background-color: green; |
| margin-right: 15px; |
| } |
| </style> |
| <body> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| // Neutral keyframes use the inline style. |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: neutralKeyframe, |
| to: '20deg', |
| }, [ |
| {at: -0.3, is: '7deg'}, |
| {at: 0, is: '10deg'}, |
| {at: 0.3, is: '13deg'}, |
| {at: 0.6, is: '16deg'}, |
| {at: 1, is: '20deg'}, |
| {at: 1.5, is: '25deg'}, |
| ]); |
| |
| // No interpolation to an angle from the initial value 'auto'. |
| assertNoInterpolation({ |
| property: 'offset-rotate', |
| from: 'initial', |
| to: '20deg', |
| }); |
| |
| // 'inherit' keyframes use the parent style. |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: 'inherit', |
| to: '20deg', |
| }, [ |
| {at: -0.3, is: '33deg'}, |
| {at: 0, is: '30deg'}, |
| {at: 0.3, is: '27deg'}, |
| {at: 0.6, is: '24deg'}, |
| {at: 1, is: '20deg'}, |
| {at: 1.5, is: '15deg'}, |
| ]); |
| |
| // No interpolation to an angle from the initial value 'auto'. |
| assertNoInterpolation({ |
| property: 'offset-rotate', |
| from: 'unset', |
| to: '20deg', |
| }); |
| |
| // Interpolation between angles. |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: '10deg', |
| to: '50deg' |
| }, [ |
| {at: -0.3, is: '-2deg'}, |
| {at: 0, is: '10deg'}, |
| {at: 0.3, is: '22deg'}, |
| {at: 0.6, is: '34deg'}, |
| {at: 1, is: '50deg'}, |
| {at: 1.5, is: '70deg'}, |
| ]); |
| |
| // Interpolation between auto angles. |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: 'auto 10deg', |
| to: 'auto 50deg' |
| }, [ |
| {at: -0.3, is: 'auto -2deg'}, |
| {at: 0, is: 'auto 10deg'}, |
| {at: 0.3, is: 'auto 22deg'}, |
| {at: 0.6, is: 'auto 34deg'}, |
| {at: 1, is: 'auto 50deg'}, |
| {at: 1.5, is: 'auto 70deg'}, |
| ]); |
| |
| // 'reverse' is like 'auto 180deg'. |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: 'reverse -170deg', |
| to: 'reverse -130deg' |
| }, [ |
| {at: -0.3, is: 'auto -2deg'}, |
| {at: 0, is: 'auto 10deg'}, |
| {at: 0.3, is: 'auto 22deg'}, |
| {at: 0.6, is: 'auto 34deg'}, |
| {at: 1, is: 'auto 50deg'}, |
| {at: 1.5, is: 'auto 70deg'}, |
| ]); |
| |
| // Interpolation between 'auto' and 'reverse'. |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: 'auto 10deg', |
| to: 'reverse -130deg' |
| }, [ |
| {at: -0.3, is: 'auto -2deg'}, |
| {at: 0, is: 'auto 10deg'}, |
| {at: 0.3, is: 'auto 22deg'}, |
| {at: 0.6, is: 'auto 34deg'}, |
| {at: 1, is: 'auto 50deg'}, |
| {at: 1.5, is: 'auto 70deg'}, |
| ]); |
| assertInterpolation({ |
| property: 'offset-rotate', |
| from: 'reverse -170deg', |
| to: 'auto 50deg' |
| }, [ |
| {at: -0.3, is: 'auto -2deg'}, |
| {at: 0, is: 'auto 10deg'}, |
| {at: 0.3, is: 'auto 22deg'}, |
| {at: 0.6, is: 'auto 34deg'}, |
| {at: 1, is: 'auto 50deg'}, |
| {at: 1.5, is: 'auto 70deg'}, |
| ]); |
| |
| // No interpolation between auto/reverse and angle. |
| assertNoInterpolation({ |
| property: 'offset-rotate', |
| from: 'auto 200deg', |
| to: '300deg' |
| }); |
| assertNoInterpolation({ |
| property: 'offset-rotate', |
| from: '300deg', |
| to: 'reverse 20deg' |
| }); |
| </script> |
| </body> |