| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/ahem.js"></script> |
| <style> |
| :root { |
| font: 50px Ahem; |
| } |
| </style> |
| </head> |
| <body> |
| <svg> |
| <defs> |
| <path id="path1" d="m 0 0 h 250 v 250 h -250 z"/> |
| </defs> |
| </svg> |
| <template id="target-template"> |
| <svg width="7px" height="17px" viewBox="0 0 140 340"> |
| <text text-anchor="middle"> |
| <textPath xlink:href="#path1" startOffset="50%" class="target"> |
| Text on a path |
| </textPath> |
| </text> |
| </svg> |
| </template> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| 'use strict'; |
| assertAttributeInterpolation({ |
| property: 'startOffset', |
| from: '1', |
| to: '6' |
| }, [ |
| {at: -0.4, is: -1}, |
| {at: 0, is: 1}, |
| {at: 0.2, is: 2}, |
| {at: 0.6, is: 4}, |
| {at: 1, is: 6}, |
| {at: 1.4, is: 8} |
| ]); |
| assertAttributeInterpolation({ |
| property: 'startOffset', |
| from: '25%', // 25% of 1000px path length is 250px. |
| to: '25em' // 25 times 50px font size is 1250px. |
| }, [ |
| {at: -0.4, is: -150}, |
| {at: 0, is: 250}, |
| {at: 0.2, is: 450}, |
| {at: 0.6, is: 850}, |
| {at: 1, is: 1250}, |
| {at: 1.4, is: 1650} |
| ]); |
| </script> |
| </body> |
| </html> |