| 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 { |
| 8 stop-color: blue; |
| 9 } |
| 10 .target { |
| 11 stop-color: orange; |
| 12 } |
| 13 rect { |
| 9 fill: url(#test); | 14 fill: url(#test); |
| 10 stroke: black; | |
| 11 stroke-width: 10px; | |
| 12 } | |
| 13 svg:nth-child(2n) rect { | |
| 14 stroke: green; | |
| 15 } | 15 } |
| 16 </style><body> | 16 </style><body> |
| 17 <template id="target-template"> | 17 <template id="target-template"> |
| 18 <svg> | 18 <svg width="10" height="100"> |
| 19 <defs> | 19 <defs> |
| 20 <linearGradient id="test"> | 20 <linearGradient gradientTransform="rotate(90)" id="test"> |
| 21 <stop offset="5%" stop-color="white"></stop> | 21 <stop offset="0%" stop-color="black"></stop> |
| 22 <stop offset="95%" class="target"></stop> | 22 <stop offset="50%" class="target"></stop> |
| 23 </linearGradient> | 23 </linearGradient> |
| 24 </defs> | 24 </defs> |
| 25 <rect width="100" height="100"></rect> | 25 <rect width="10" height="100"></rect> |
| 26 </svg> | 26 </svg> |
| 27 </template> | 27 </template> |
| 28 <script src="resources/interpolation-test.js"></script> | 28 <script src="resources/interpolation-test.js"></script> |
| 29 <script> | 29 <script> |
| 30 assertInterpolation({ | 30 assertInterpolation({ |
| 31 property: 'stop-color', | 31 property: 'stop-color', |
| 32 from: '', |
| 33 to: 'green', |
| 34 }, [ |
| 35 {at: -5, is: 'rgb(255, 255, 0)'}, |
| 36 {at: -0.4, is: 'rgb(255, 180, 0)'}, |
| 37 {at: 0, is: 'rgb(255, 165, 0)'}, |
| 38 {at: 0.2, is: 'rgb(204, 158, 0)'}, |
| 39 {at: 0.6, is: 'rgb(102, 143, 0)'}, |
| 40 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 41 {at: 1.5, is: 'rgb(0, 110, 0)'}, |
| 42 ]); |
| 43 |
| 44 assertInterpolation({ |
| 45 property: 'stop-color', |
| 46 from: 'initial', |
| 47 to: 'green', |
| 48 }, [ |
| 49 {at: -5, is: 'rgb(0, 0, 0)'}, |
| 50 {at: -0.4, is: 'rgb(0, 0, 0)'}, |
| 51 {at: 0, is: 'rgb(0, 0, 0)'}, |
| 52 {at: 0.2, is: 'rgb(0, 26, 0)'}, |
| 53 {at: 0.6, is: 'rgb(0, 77, 0)'}, |
| 54 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 55 {at: 1.5, is: 'rgb(0, 192, 0)'}, |
| 56 ]); |
| 57 |
| 58 assertInterpolation({ |
| 59 property: 'stop-color', |
| 60 from: 'inherit', |
| 61 to: 'green', |
| 62 }, [ |
| 63 {at: -5, is: 'rgb(0, 0, 255)'}, |
| 64 {at: -0.4, is: 'rgb(0, 0, 255)'}, |
| 65 {at: 0, is: 'rgb(0, 0, 255)'}, |
| 66 {at: 0.2, is: 'rgb(0, 26, 204)'}, |
| 67 {at: 0.6, is: 'rgb(0, 77, 102)'}, |
| 68 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 69 {at: 1.5, is: 'rgb(0, 192, 0)'}, |
| 70 ]); |
| 71 |
| 72 assertInterpolation({ |
| 73 property: 'stop-color', |
| 74 from: 'unset', |
| 75 to: 'green', |
| 76 }, [ |
| 77 {at: -5, is: 'rgb(0, 0, 0)'}, |
| 78 {at: -0.4, is: 'rgb(0, 0, 0)'}, |
| 79 {at: 0, is: 'rgb(0, 0, 0)'}, |
| 80 {at: 0.2, is: 'rgb(0, 26, 0)'}, |
| 81 {at: 0.6, is: 'rgb(0, 77, 0)'}, |
| 82 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 83 {at: 1.5, is: 'rgb(0, 192, 0)'}, |
| 84 ]); |
| 85 |
| 86 assertInterpolation({ |
| 87 property: 'stop-color', |
| 32 from: 'orange', | 88 from: 'orange', |
| 33 to: 'blue' | 89 to: 'blue' |
| 34 }, [ | 90 }, [ |
| 35 {at: -5, is: '#ffff00'}, | 91 {at: -5, is: '#ffff00'}, |
| 36 {at: -0.4, is: '#ffe700'}, | 92 {at: -0.4, is: '#ffe700'}, |
| 37 {at: 0, is: 'orange'}, // ffa500 | 93 {at: 0, is: 'orange'}, // ffa500 |
| 38 {at: 0.2, is: '#cc8433'}, | 94 {at: 0.2, is: '#cc8433'}, |
| 39 {at: 0.6, is: '#664299'}, | 95 {at: 0.6, is: '#664299'}, |
| 40 {at: 1, is: 'blue'}, // 0000ff | 96 {at: 1, is: 'blue'}, // 0000ff |
| 41 {at: 1.5, is: 'blue'} | 97 {at: 1.5, is: 'blue'} |
| 42 ]); | 98 ]); |
| 43 </script> | 99 </script> |
| 44 </body> | 100 </body> |
| OLD | NEW |