OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
3 <style> | 3 <style> |
4 div.wrapper { | 4 .parent { |
5 border: 10px solid black; | 5 -webkit-mask-box-image-source: url(../resources/blue-100.png); |
| 6 } |
| 7 .target { |
| 8 display: inline-block; |
6 width: 100px; | 9 width: 100px; |
7 height: 100px; | 10 height: 100px; |
8 display: inline-block; | |
9 margin-bottom: 10px; | 11 margin-bottom: 10px; |
10 background-color: #FF7400; | 12 background: black; |
| 13 /*-webkit-mask-box-image-slice: 25;*/ |
| 14 -webkit-mask-box-image-source: url(../resources/stripes-100.png); |
11 } | 15 } |
12 div.wrapper:nth-child(2n) { | 16 .expected { |
13 border-color: green; | 17 background: green; |
14 } | 18 margin-right: 10px; |
15 div.wrapper div.target { | |
16 background-color: #009999; | |
17 height: 100%; | |
18 -webkit-mask-box-image-slice: 25; | |
19 } | 19 } |
20 </style> | 20 </style> |
21 <body> | 21 <body> |
22 <template id="target-template"> | |
23 <div class="wrapper"> | |
24 <div class="target"></div> | |
25 </div> | |
26 </template> | |
27 <script src="resources/interpolation-test.js"></script> | 22 <script src="resources/interpolation-test.js"></script> |
28 <script> | 23 <script> |
29 // None to image | 24 function assertCrossfadeInterpolation(options) { |
30 var from = 'none'; | 25 var fromComputed = options.fromComputed || options.from; |
31 var to = 'url(../resources/stripes-100.png)'; | 26 assertInterpolation({ |
| 27 property: '-webkit-mask-box-image-source', |
| 28 from: options.from, |
| 29 to: options.to, |
| 30 }, [ |
| 31 {at: -0.3, is: fromComputed}, |
| 32 {at: 0, is: fromComputed}, |
| 33 {at: 0.3, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ',
0.3)'}, |
| 34 {at: 0.5, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ',
0.5)'}, |
| 35 {at: 0.6, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ',
0.6)'}, |
| 36 {at: 1, is: options.to}, |
| 37 {at: 1.5, is: options.to}, |
| 38 ]); |
| 39 } |
| 40 |
| 41 // neutral |
| 42 assertCrossfadeInterpolation({ |
| 43 from: '', |
| 44 fromComputed: 'url(../resources/stripes-100.png)', |
| 45 to: 'url(../resources/green-100.png)', |
| 46 }); |
| 47 |
| 48 // initial |
32 assertNoInterpolation({ | 49 assertNoInterpolation({ |
33 property: '-webkit-mask-box-image-source', | 50 property: '-webkit-mask-box-image-source', |
34 from: from, | 51 from: 'initial', |
35 to: to | 52 to: 'url(../resources/green-100.png)', |
| 53 }); |
| 54 |
| 55 // inherit |
| 56 assertCrossfadeInterpolation({ |
| 57 from: 'inherit', |
| 58 fromComputed: 'url(../resources/blue-100.png)', |
| 59 to: 'url(../resources/green-100.png)', |
| 60 }); |
| 61 |
| 62 // unset |
| 63 assertNoInterpolation({ |
| 64 property: '-webkit-mask-box-image-source', |
| 65 from: 'unset', |
| 66 to: 'url(../resources/stripes-100.png)', |
| 67 }); |
| 68 |
| 69 // None to image |
| 70 assertNoInterpolation({ |
| 71 property: '-webkit-mask-box-image-source', |
| 72 from: 'none', |
| 73 to: 'url(../resources/stripes-100.png)', |
36 }); | 74 }); |
37 | 75 |
38 // Image to image | 76 // Image to image |
39 from = 'url(../resources/green-100.png)'; | 77 assertCrossfadeInterpolation({ |
40 to = 'url(../resources/stripes-100.png)'; | |
41 assertInterpolation({ | |
42 property: '-webkit-mask-box-image-source', | 78 property: '-webkit-mask-box-image-source', |
43 from: from, | 79 from: 'url(../resources/green-100.png)', |
44 to: to | 80 to: 'url(../resources/stripes-100.png)', |
45 }, [ | 81 }); |
46 {at: -0.3, is: from}, | |
47 {at: 0, is: from}, | |
48 {at: 0.3, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.3)'}, | |
49 {at: 0.6, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.6)'}, | |
50 {at: 1, is: to}, | |
51 {at: 1.5, is: to}, | |
52 ]); | |
53 | 82 |
54 // Image to gradient | 83 // Image to gradient |
55 to = 'linear-gradient(45deg, blue, orange)'; | 84 assertCrossfadeInterpolation({ |
56 assertInterpolation({ | |
57 property: '-webkit-mask-box-image-source', | 85 property: '-webkit-mask-box-image-source', |
58 from: from, | 86 from: 'url(../resources/green-100.png)', |
59 to: to | 87 to: 'linear-gradient(45deg, blue, orange)', |
60 }, [ | 88 }); |
61 {at: -0.3, is: from}, | |
62 {at: 0, is: from}, | |
63 {at: 0.3, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.3)'}, | |
64 {at: 0.6, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.6)'}, | |
65 {at: 1, is: to}, | |
66 {at: 1.5, is: to}, | |
67 ]); | |
68 | 89 |
69 // Gradient to gradient | 90 // Gradient to gradient |
70 from = 'linear-gradient(-45deg, red, yellow)'; | 91 assertCrossfadeInterpolation({ |
71 assertInterpolation({ | |
72 property: '-webkit-mask-box-image-source', | 92 property: '-webkit-mask-box-image-source', |
73 from: from, | 93 from: 'linear-gradient(-45deg, red, yellow)', |
74 to: to | 94 to: 'linear-gradient(45deg, blue, orange)', |
75 }, [ | 95 }); |
76 {at: -0.3, is: from}, | |
77 {at: 0, is: from}, | |
78 {at: 0.3, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.3)'}, | |
79 {at: 0.6, is: '-webkit-cross-fade(' + from + ', ' + to + ', 0.6)'}, | |
80 {at: 1, is: to}, | |
81 {at: 1.5, is: to}, | |
82 ]); | |
83 </script> | 96 </script> |
84 </body> | 97 </body> |
OLD | NEW |