| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| svg { |
| width: 100px; |
| height: 100px; |
| } |
| svg rect { |
| stroke: black; |
| stroke-width: 20px; |
| } |
| svg:nth-child(2n) rect { |
| stroke: green; |
| } |
| </style> |
| <body> |
| <template id="target-template"> |
| <svg> |
| <defs> |
| <linearGradient id="gradient" x1="0" x2="0" y1="0" y2="1"> |
| <stop offset="0" stop-color="blue" class="target"/> |
| <stop offset="1" stop-color="blue"/> |
| </linearGradient> |
| </defs> |
| <rect x="0" y="0" width="100" height="100" fill="url(#gradient)"> |
| </template> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| assertInterpolation({ |
| property: 'stop-opacity', |
| from: '0', |
| to: '1', |
| }, [ |
| {at: -0.4, is: '0'}, |
| {at: 0, is: '0'}, |
| {at: 0.2, is: '0.2'}, |
| {at: 0.6, is: '0.6'}, |
| {at: 1, is: '1'}, |
| {at: 1.5, is: '1'} |
| ]); |
| </script> |
| </body> |