| <!DOCTYPE html> |
| <html> |
| <body> |
| <template id="target-template"> |
| <svg width="90" height="90"> |
| <line class="target" x1="10" y1="10" x2="60" y2="60" /> |
| </svg> |
| </template> |
| <script src="../svg-attribute-interpolation/resources/interpolation-test.js"></script> |
| <script> |
| 'use strict'; |
| assertAttributeInterpolation({ |
| property: 'x1', |
| underlying: 20, |
| from: -10, |
| fromComposite: 'add', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'x2', |
| underlying: 20, |
| from: -10, |
| fromComposite: 'add', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'y1', |
| underlying: 20, |
| from: -10, |
| fromComposite: 'add', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'y2', |
| underlying: 20, |
| from: -10, |
| fromComposite: 'add', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| |
| assertAttributeInterpolation({ |
| property: 'x1', |
| underlying: 20, |
| from: 10, |
| fromComposite: 'replace', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'x2', |
| underlying: 20, |
| from: 10, |
| fromComposite: 'replace', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'y1', |
| underlying: 20, |
| from: 10, |
| fromComposite: 'replace', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'y2', |
| underlying: 20, |
| from: 10, |
| fromComposite: 'replace', |
| to: 40, |
| toComposite: 'add' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| |
| assertAttributeInterpolation({ |
| property: 'x1', |
| underlying: 10, |
| from: neutralKeyframe, |
| to: 60, |
| toComposite: 'replace' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'x2', |
| underlying: 10, |
| from: neutralKeyframe, |
| to: 60, |
| toComposite: 'replace' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'y1', |
| underlying: 10, |
| from: neutralKeyframe, |
| to: 60, |
| toComposite: 'replace' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'y2', |
| underlying: 10, |
| from: neutralKeyframe, |
| to: 60, |
| toComposite: 'replace' |
| }, [ |
| {at: -0.4, is: -10}, |
| {at: 0, is: 10}, |
| {at: 0.2, is: 20}, |
| {at: 0.6, is: 40}, |
| {at: 1, is: 60}, |
| {at: 1.4, is: 80} |
| ]); |
| </script> |
| </body> |
| </html> |