| <!DOCTYPE html> |
| <meta charset="UTF-8"> |
| <style> |
| .container { |
| display: inline-block; |
| } |
| .parent { |
| flood-opacity: 0.8; |
| } |
| .target { |
| flood-opacity: 0.6; |
| } |
| svg { |
| background: black; |
| } |
| rect { |
| fill: black; |
| filter: url(#test); |
| } |
| </style> |
| <body> |
| <template id="target-template"> |
| <svg width="10" height="100"> |
| <defs> |
| <filter id="test"> |
| <feFlood x="0" y="0" width="10" height="100" flood-color="blue" class="target" /> |
| </filter> |
| </defs> |
| <rect width="10" height="100"></rect> |
| </svg> |
| </template> |
| <script src="resources/interpolation-test.js"></script> |
| <script> |
| assertInterpolation({ |
| property: 'flood-opacity', |
| from: neutralKeyframe, |
| to: '0.4', |
| }, [ |
| {at: -1, is: '0.8'}, |
| {at: -0.25, is: '0.65'}, |
| {at: 0, is: '0.6'}, |
| {at: 0.25, is: '0.55'}, |
| {at: 1, is: '0.4'}, |
| {at: 1.25, is: '0.35'}, |
| {at: 2, is: '0.2'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'flood-opacity', |
| from: 'initial', |
| to: '0.4', |
| }, [ |
| {at: -1, is: '1'}, |
| {at: -0.25, is: '1'}, |
| {at: 0, is: '1'}, |
| {at: 0.25, is: '0.85'}, |
| {at: 1, is: '0.4'}, |
| {at: 1.25, is: '0.25'}, |
| {at: 2, is: '0'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'flood-opacity', |
| from: 'inherit', |
| to: '0.4', |
| }, [ |
| {at: -1, is: '1'}, |
| {at: -0.25, is: '0.9'}, |
| {at: 0, is: '0.8'}, |
| {at: 0.25, is: '0.7'}, |
| {at: 1, is: '0.4'}, |
| {at: 1.25, is: '0.3'}, |
| {at: 2, is: '0'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'flood-opacity', |
| from: 'unset', |
| to: '0.4', |
| }, [ |
| {at: -1, is: '1'}, |
| {at: -0.25, is: '1'}, |
| {at: 0, is: '1'}, |
| {at: 0.25, is: '0.85'}, |
| {at: 1, is: '0.4'}, |
| {at: 1.25, is: '0.25'}, |
| {at: 2, is: '0'}, |
| ]); |
| |
| assertInterpolation({ |
| property: 'flood-opacity', |
| from: '0.25', |
| to: '0.75' |
| }, [ |
| {at: -1, is: '0'}, // SVG Opacity ranges from 0.0 to 1.0 |
| {at: -0.25, is: '0.125'}, |
| {at: 0, is: '0.25'}, |
| {at: 0.25, is: '0.375'}, |
| {at: 1, is: '0.75'}, |
| {at: 1.25, is: '0.875'}, |
| {at: 2, is: '1'}, // SVG Opacity ranges from 0.0 to 1.0 |
| ]); |
| </script> |
| </body> |