| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
| 3 <style> | 3 <style> |
| 4 svg { | 4 .container { |
| 5 width: 100px; | 5 display: inline-block; |
| 6 height: 100px; | |
| 7 } | 6 } |
| 8 svg rect { | 7 .parent { |
| 9 stroke: black; | 8 stop-opacity: 0.8; |
| 10 stroke-width: 20px; | |
| 11 } | 9 } |
| 12 svg:nth-child(2n) rect { | 10 .target { |
| 13 stroke: green; | 11 stop-opacity: 0.6; |
| 14 } | 12 } |
| 15 </style> | 13 </style> |
| 16 <body> | 14 <body> |
| 17 <template id="target-template"> | 15 <template id="target-template"> |
| 18 <svg> | 16 <svg width="10" height="100"> |
| 19 <defs> | 17 <defs> |
| 20 <linearGradient id="gradient" x1="0" x2="0" y1="0" y2="1"> | 18 <linearGradient id="gradient" x1="0" x2="0" y1="0" y2="1"> |
| 21 <stop offset="0" stop-color="blue" class="target"/> | 19 <stop offset="0" stop-color="black"/> |
| 22 <stop offset="1" stop-color="blue"/> | 20 <stop offset="1" stop-color="blue" class="target"/> |
| 23 </linearGradient> | 21 </linearGradient> |
| 24 </defs> | 22 </defs> |
| 25 <rect x="0" y="0" width="100" height="100" fill="url(#gradient)"> | 23 <rect x="0" y="0" width="10" height="100" fill="url(#gradient)"></rect> |
| 24 </svg> |
| 26 </template> | 25 </template> |
| 27 <script src="resources/interpolation-test.js"></script> | 26 <script src="resources/interpolation-test.js"></script> |
| 28 <script> | 27 <script> |
| 29 assertInterpolation({ | 28 assertInterpolation({ |
| 30 property: 'stop-opacity', | 29 property: 'stop-opacity', |
| 30 from: '', |
| 31 to: '0.4', |
| 32 }, [ |
| 33 {at: -0.4, is: '0.68'}, |
| 34 {at: 0, is: '0.6'}, |
| 35 {at: 0.2, is: '0.56'}, |
| 36 {at: 0.6, is: '0.48'}, |
| 37 {at: 1, is: '0.4'}, |
| 38 {at: 1.5, is: '0.3'}, |
| 39 ]); |
| 40 |
| 41 assertInterpolation({ |
| 42 property: 'stop-opacity', |
| 43 from: 'initial', |
| 44 to: '0.4', |
| 45 }, [ |
| 46 {at: -0.4, is: '1'}, |
| 47 {at: 0, is: '1'}, |
| 48 {at: 0.2, is: '0.88'}, |
| 49 {at: 0.6, is: '0.64'}, |
| 50 {at: 1, is: '0.4'}, |
| 51 {at: 1.5, is: '0.1'}, |
| 52 ]); |
| 53 |
| 54 assertInterpolation({ |
| 55 property: 'stop-opacity', |
| 56 from: 'inherit', |
| 57 to: '0.4', |
| 58 }, [ |
| 59 {at: -0.4, is: '0.96'}, |
| 60 {at: 0, is: '0.8'}, |
| 61 {at: 0.2, is: '0.72'}, |
| 62 {at: 0.6, is: '0.56'}, |
| 63 {at: 1, is: '0.4'}, |
| 64 {at: 1.5, is: '0.2'}, |
| 65 ]); |
| 66 |
| 67 assertInterpolation({ |
| 68 property: 'stop-opacity', |
| 69 from: 'unset', |
| 70 to: '0.4', |
| 71 }, [ |
| 72 {at: -0.4, is: '1'}, |
| 73 {at: 0, is: '1'}, |
| 74 {at: 0.2, is: '0.88'}, |
| 75 {at: 0.6, is: '0.64'}, |
| 76 {at: 1, is: '0.4'}, |
| 77 {at: 1.5, is: '0.1'}, |
| 78 ]); |
| 79 |
| 80 assertInterpolation({ |
| 81 property: 'stop-opacity', |
| 31 from: '0', | 82 from: '0', |
| 32 to: '1', | 83 to: '1', |
| 33 }, [ | 84 }, [ |
| 34 {at: -0.4, is: '0'}, | 85 {at: -0.4, is: '0'}, |
| 35 {at: 0, is: '0'}, | 86 {at: 0, is: '0'}, |
| 36 {at: 0.2, is: '0.2'}, | 87 {at: 0.2, is: '0.2'}, |
| 37 {at: 0.6, is: '0.6'}, | 88 {at: 0.6, is: '0.6'}, |
| 38 {at: 1, is: '1'}, | 89 {at: 1, is: '1'}, |
| 39 {at: 1.5, is: '1'} | 90 {at: 1.5, is: '1'} |
| 40 ]); | 91 ]); |
| 41 </script> | 92 </script> |
| 42 </body> | 93 </body> |
| OLD | NEW |