| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| .container { |
| display: inline-block; |
| } |
| .parent { |
| r: 30px; |
| } |
| .target { |
| fill: black; |
| r: 10px; |
| } |
| .expected { |
| fill: green; |
| } |
| </style> |
| <body> |
| <template id="target-template"> |
| <svg width="70" height="70"> |
| <circle cx="35" cy="35" r="10" class="target"/> |
| </svg> |
| </template> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| assertInterpolation({ |
| property: 'r', |
| from: neutralKeyframe, |
| to: '20px', |
| }, [ |
| {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'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'r', |
| from: 'initial', |
| to: '20px', |
| }, [ |
| {at: -0.3, is: '0px'}, |
| {at: 0, is: '0px'}, |
| {at: 0.3, is: '6px'}, |
| {at: 0.6, is: '12px'}, |
| {at: 1, is: '20px'}, |
| {at: 1.5, is: '30px'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'r', |
| from: 'inherit', |
| to: '20px', |
| }, [ |
| {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'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'r', |
| from: 'unset', |
| to: '20px', |
| }, [ |
| {at: -0.3, is: '0px'}, |
| {at: 0, is: '0px'}, |
| {at: 0.3, is: '6px'}, |
| {at: 0.6, is: '12px'}, |
| {at: 1, is: '20px'}, |
| {at: 1.5, is: '30px'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'r', |
| from: '0px', |
| to: '20px' |
| }, [ |
| {at: -0.3, is: '0px'}, // SVG r can't be negative. |
| {at: 0, is: '0px'}, |
| {at: 0.3, is: '6px'}, |
| {at: 0.6, is: '12px'}, |
| {at: 1, is: '20px'}, |
| {at: 1.5, is: '30px'}, |
| ]); |
| assertInterpolation({ |
| property: 'r', |
| from: '0px', |
| to: '10em' |
| }, [ |
| {at: -0.3, is: '0em'}, // SVG r can't be negative. |
| {at: 0, is: '0em'}, |
| {at: 0.3, is: '3em'}, |
| {at: 0.6, is: '6em'}, |
| {at: 1, is: '10em'}, |
| {at: 1.5, is: '15em'}, |
| ]); |
| assertInterpolation({ |
| property: 'r', |
| from: '30px', |
| to: '10em' |
| }, [ |
| {at: -0.3, is: '0px'}, |
| {at: 0, is: '30px'}, |
| {at: 0.3, is: '69px'}, |
| {at: 0.6, is: '108px'}, |
| {at: 1, is: '10em'}, |
| {at: 1.5, is: '225px'}, |
| ]); |
| assertInterpolation({ |
| property: 'r', |
| from: '10em', |
| to: '0px' |
| }, [ |
| {at: -0.3, is: '13em'}, |
| {at: 0, is: '10em'}, |
| {at: 0.3, is: '7em'}, |
| {at: 0.6, is: '4em'}, |
| {at: 1, is: '0em'}, |
| {at: 1.5, is: '0em'}, // SVG r can't be negative. |
| ]); |
| assertInterpolation({ |
| property: 'r', |
| from: '10em', |
| to: '30px' |
| }, [ |
| {at: -0.3, is: '199px'}, |
| {at: 0, is: '10em'}, |
| {at: 0.3, is: '121px'}, |
| {at: 0.6, is: '82px'}, |
| {at: 1, is: '30px'}, |
| {at: 1.5, is: '0px'}, |
| ]); |
| assertInterpolation({ |
| property: 'r', |
| from: '0', |
| to: '20' |
| }, [ |
| {at: -0.3, is: '0'}, |
| {at: 0, is: '0'}, |
| {at: 0.3, is: '6'}, |
| {at: 0.6, is: '12'}, |
| {at: 1, is: '20'}, |
| {at: 1.5, is: '30'}, |
| ]); |
| </script> |
| </body> |