| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
| 3 <style> | 3 <style> |
| 4 .container { |
| 5 display: inline-block; |
| 6 } |
| 7 .parent { |
| 8 flood-opacity: 0.8; |
| 9 } |
| 10 .target { |
| 11 flood-opacity: 0.6; |
| 12 } |
| 4 svg { | 13 svg { |
| 5 width: 100px; | 14 background: black; |
| 6 height: 100px; | |
| 7 background: red; | |
| 8 } | 15 } |
| 9 svg rect { | 16 rect { |
| 10 fill: black; | 17 fill: black; |
| 11 filter: url(#test); | 18 filter: url(#test); |
| 12 } | 19 } |
| 13 </style> | 20 </style> |
| 14 <body> | 21 <body> |
| 15 <template id="target-template"> | 22 <template id="target-template"> |
| 16 <svg> | 23 <svg width="10" height="100"> |
| 17 <defs> | 24 <defs> |
| 18 <filter id="test"> | 25 <filter id="test"> |
| 19 <feFlood x="10" y="10" width="80" height="80" flood-color="blue" class="
target" /> | 26 <feFlood x="0" y="0" width="10" height="100" flood-color="blue" class="t
arget" /> |
| 20 </filter> | 27 </filter> |
| 21 </defs> | 28 </defs> |
| 22 <rect width="100" height="100"></rect> | 29 <rect width="10" height="100"></rect> |
| 23 </svg> | 30 </svg> |
| 24 </template> | 31 </template> |
| 25 <script src="resources/interpolation-test.js"></script> | 32 <script src="resources/interpolation-test.js"></script> |
| 26 <script> | 33 <script> |
| 27 assertInterpolation({ | 34 assertInterpolation({ |
| 28 property: 'flood-opacity', | 35 property: 'flood-opacity', |
| 36 from: '', |
| 37 to: '0.4', |
| 38 }, [ |
| 39 {at: -1, is: '0.8'}, |
| 40 {at: -0.25, is: '0.65'}, |
| 41 {at: 0, is: '0.6'}, |
| 42 {at: 0.25, is: '0.55'}, |
| 43 {at: 1, is: '0.4'}, |
| 44 {at: 1.25, is: '0.35'}, |
| 45 {at: 2, is: '0.2'}, |
| 46 ]); |
| 47 |
| 48 assertInterpolation({ |
| 49 property: 'flood-opacity', |
| 50 from: 'initial', |
| 51 to: '0.4', |
| 52 }, [ |
| 53 {at: -1, is: '1'}, |
| 54 {at: -0.25, is: '1'}, |
| 55 {at: 0, is: '1'}, |
| 56 {at: 0.25, is: '0.85'}, |
| 57 {at: 1, is: '0.4'}, |
| 58 {at: 1.25, is: '0.25'}, |
| 59 {at: 2, is: '0'}, |
| 60 ]); |
| 61 |
| 62 assertInterpolation({ |
| 63 property: 'flood-opacity', |
| 64 from: 'inherit', |
| 65 to: '0.4', |
| 66 }, [ |
| 67 {at: -1, is: '1'}, |
| 68 {at: -0.25, is: '0.9'}, |
| 69 {at: 0, is: '0.8'}, |
| 70 {at: 0.25, is: '0.7'}, |
| 71 {at: 1, is: '0.4'}, |
| 72 {at: 1.25, is: '0.3'}, |
| 73 {at: 2, is: '0'}, |
| 74 ]); |
| 75 |
| 76 assertInterpolation({ |
| 77 property: 'flood-opacity', |
| 78 from: 'unset', |
| 79 to: '0.4', |
| 80 }, [ |
| 81 {at: -1, is: '1'}, |
| 82 {at: -0.25, is: '1'}, |
| 83 {at: 0, is: '1'}, |
| 84 {at: 0.25, is: '0.85'}, |
| 85 {at: 1, is: '0.4'}, |
| 86 {at: 1.25, is: '0.25'}, |
| 87 {at: 2, is: '0'}, |
| 88 ]); |
| 89 |
| 90 assertInterpolation({ |
| 91 property: 'flood-opacity', |
| 29 from: '0.25', | 92 from: '0.25', |
| 30 to: '0.75' | 93 to: '0.75' |
| 31 }, [ | 94 }, [ |
| 32 {at: -1, is: '0'}, // SVG Opacity ranges from 0.0 to 1.0 | 95 {at: -1, is: '0'}, // SVG Opacity ranges from 0.0 to 1.0 |
| 33 {at: -0.25, is: '0.125'}, | 96 {at: -0.25, is: '0.125'}, |
| 34 {at: 0, is: '0.25'}, | 97 {at: 0, is: '0.25'}, |
| 35 {at: 0.25, is: '0.375'}, | 98 {at: 0.25, is: '0.375'}, |
| 36 {at: 1, is: '0.75'}, | 99 {at: 1, is: '0.75'}, |
| 37 {at: 1.25, is: '0.875'}, | 100 {at: 1.25, is: '0.875'}, |
| 38 {at: 2, is: '1'}, // SVG Opacity ranges from 0.0 to 1.0 | 101 {at: 2, is: '1'}, // SVG Opacity ranges from 0.0 to 1.0 |
| 39 ]); | 102 ]); |
| 40 </script> | 103 </script> |
| 41 </body> | 104 </body> |
| OLD | NEW |