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 margin-right: 1px; |
| 7 } |
| 8 .parent { |
| 9 fill: blue; |
| 10 } |
4 .target { | 11 .target { |
5 width: 100px; | 12 color: blue; |
6 height: 100px; | 13 stroke-width: 10px; |
7 stroke: black; | 14 stroke: black; |
8 stroke-width: 20px; | 15 fill: orange; |
9 color: blue; | |
10 } | 16 } |
11 .expected { | 17 .expected { |
12 stroke: green; | 18 stroke: green; |
13 } | 19 } |
14 </style> | 20 </style> |
15 <body> | 21 <body> |
16 <template id="target-template"> | 22 <template id="target-template"> |
17 <svg> | 23 <svg width="40" height="40"> |
18 <defs> | 24 <defs> |
19 <linearGradient id="gradient"> | 25 <linearGradient id="gradient"> |
20 <stop offset="0" stop-color="green"/> | 26 <stop offset="0" stop-color="green"/> |
21 <stop offset="1" stop-color="gold"/> | 27 <stop offset="1" stop-color="gold"/> |
22 </linearGradient> | 28 </linearGradient> |
23 </defs> | 29 </defs> |
24 <rect x="0" y="0" width="100" height="100"> | 30 <rect x="0" y="0" width="40" height="40" class="target"></rect> |
| 31 </svg> |
25 </template> | 32 </template> |
26 <script src="resources/interpolation-test.js"></script> | 33 <script src="resources/interpolation-test.js"></script> |
27 <script> | 34 <script> |
28 assertInterpolation({ | 35 assertInterpolation({ |
29 property: 'fill', | 36 property: 'fill', |
| 37 from: '', |
| 38 to: 'green', |
| 39 }, [ |
| 40 {at: -5, is: 'rgb(255, 255, 0)'}, |
| 41 {at: -0.4, is: 'rgb(255, 180, 0)'}, |
| 42 {at: 0, is: 'rgb(255, 165, 0)'}, |
| 43 {at: 0.2, is: 'rgb(204, 158, 0)'}, |
| 44 {at: 0.6, is: 'rgb(102, 143, 0)'}, |
| 45 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 46 {at: 1.5, is: 'rgb(0, 110, 0)'}, |
| 47 ]); |
| 48 |
| 49 assertInterpolation({ |
| 50 property: 'fill', |
| 51 from: 'initial', |
| 52 to: 'green', |
| 53 }, [ |
| 54 {at: -5, is: 'rgb(0, 0, 0)'}, |
| 55 {at: -0.4, is: 'rgb(0, 0, 0)'}, |
| 56 {at: 0, is: 'rgb(0, 0, 0)'}, |
| 57 {at: 0.2, is: 'rgb(0, 26, 0)'}, |
| 58 {at: 0.6, is: 'rgb(0, 77, 0)'}, |
| 59 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 60 {at: 1.5, is: 'rgb(0, 192, 0)'}, |
| 61 ]); |
| 62 |
| 63 assertInterpolation({ |
| 64 property: 'fill', |
| 65 from: 'inherit', |
| 66 to: 'green', |
| 67 }, [ |
| 68 {at: -5, is: 'rgb(0, 0, 255)'}, |
| 69 {at: -0.4, is: 'rgb(0, 0, 255)'}, |
| 70 {at: 0, is: 'rgb(0, 0, 255)'}, |
| 71 {at: 0.2, is: 'rgb(0, 26, 204)'}, |
| 72 {at: 0.6, is: 'rgb(0, 77, 102)'}, |
| 73 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 74 {at: 1.5, is: 'rgb(0, 192, 0)'}, |
| 75 ]); |
| 76 |
| 77 assertInterpolation({ |
| 78 property: 'fill', |
| 79 from: 'unset', |
| 80 to: 'green', |
| 81 }, [ |
| 82 {at: -5, is: 'rgb(0, 0, 255)'}, |
| 83 {at: -0.4, is: 'rgb(0, 0, 255)'}, |
| 84 {at: 0, is: 'rgb(0, 0, 255)'}, |
| 85 {at: 0.2, is: 'rgb(0, 26, 204)'}, |
| 86 {at: 0.6, is: 'rgb(0, 77, 102)'}, |
| 87 {at: 1, is: 'rgb(0, 128, 0)'}, |
| 88 {at: 1.5, is: 'rgb(0, 192, 0)'}, |
| 89 ]); |
| 90 |
| 91 assertInterpolation({ |
| 92 property: 'fill', |
30 from: 'orange', | 93 from: 'orange', |
31 to: 'blue' | 94 to: 'blue', |
32 }, [ | 95 }, [ |
33 {at: -5, is: '#ffff00'}, | 96 {at: -5, is: '#ffff00'}, |
34 {at: -0.4, is: '#ffe700'}, | 97 {at: -0.4, is: '#ffe700'}, |
35 {at: 0, is: 'orange'}, | 98 {at: 0, is: 'orange'}, |
36 {at: 0.2, is: '#cc8433'}, | 99 {at: 0.2, is: '#cc8433'}, |
37 {at: 0.6, is: '#664299'}, | 100 {at: 0.6, is: '#664299'}, |
38 {at: 1, is: 'blue'}, | 101 {at: 1, is: 'blue'}, |
39 {at: 1.5, is: 'blue'} | 102 {at: 1.5, is: 'blue'} |
40 ]); | 103 ]); |
41 assertInterpolation({ | 104 assertInterpolation({ |
42 property: 'fill', | 105 property: 'fill', |
43 from: 'orange', | 106 from: 'orange', |
44 to: 'currentColor' | 107 to: 'currentColor', |
45 }, [ | 108 }, [ |
46 {at: 0, is: 'orange'}, | 109 {at: 0, is: 'orange'}, |
47 {at: 0.2, is: '#cc8433'}, | 110 {at: 0.2, is: '#cc8433'}, |
48 {at: 0.6, is: '#664299'}, | 111 {at: 0.6, is: '#664299'}, |
49 {at: 1, is: 'blue'}, | 112 {at: 1, is: 'blue'}, |
50 ]); | 113 ]); |
51 assertInterpolation({ | 114 assertInterpolation({ |
52 property: 'fill', | 115 property: 'fill', |
53 from: 'currentColor', | 116 from: 'currentColor', |
54 to: 'orange' | 117 to: 'orange', |
55 }, [ | 118 }, [ |
56 {at: 0, is: 'blue'}, | 119 {at: 0, is: 'blue'}, |
57 {at: 0.2, is: '#3321cc'}, | 120 {at: 0.2, is: '#3321cc'}, |
58 {at: 0.6, is: '#996366'}, | 121 {at: 0.6, is: '#996366'}, |
59 {at: 1, is: 'orange'}, | 122 {at: 1, is: 'orange'}, |
60 ]); | 123 ]); |
61 assertNoInterpolation({ | 124 assertNoInterpolation({ |
62 property: 'fill', | 125 property: 'fill', |
63 from: 'orange', | 126 from: 'orange', |
64 to: 'url(#gradient)' | 127 to: 'url(#gradient)', |
65 }); | 128 }); |
66 </script> | 129 </script> |
67 </body> | 130 </body> |
OLD | NEW |