OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="UTF-8"> | 2 <meta charset="UTF-8"> |
3 <style> | 3 <style> |
| 4 .parent { |
| 5 opacity: 0.8; |
| 6 } |
4 .target { | 7 .target { |
5 width: 100px; | 8 width: 100px; |
6 height: 100px; | 9 height: 100px; |
7 background-color: black; | 10 background-color: black; |
8 display: inline-block; | 11 display: inline-block; |
| 12 opacity: 0.1; |
9 } | 13 } |
10 .expected { | 14 .expected { |
11 background-color: green; | 15 background-color: green; |
12 } | 16 } |
13 </style> | 17 </style> |
14 <body> | 18 <body> |
15 <script src="resources/interpolation-test.js"></script> | 19 <script src="resources/interpolation-test.js"></script> |
16 <script> | 20 <script> |
17 assertInterpolation({ | 21 assertInterpolation({ |
18 property: 'opacity', | 22 property: 'opacity', |
| 23 from: '', |
| 24 to: '0.2', |
| 25 }, [ |
| 26 {at: -0.3, is: '0.07'}, |
| 27 {at: 0, is: '0.1'}, |
| 28 {at: 0.3, is: '0.13'}, |
| 29 {at: 0.6, is: '0.16'}, |
| 30 {at: 1, is: '0.2'}, |
| 31 {at: 1.5, is: '0.25'}, |
| 32 ]); |
| 33 |
| 34 assertInterpolation({ |
| 35 property: 'opacity', |
| 36 from: 'initial', |
| 37 to: '0.2', |
| 38 }, [ |
| 39 {at: -0.3, is: '1'}, |
| 40 {at: 0, is: '1'}, |
| 41 {at: 0.3, is: '0.76'}, |
| 42 {at: 0.6, is: '0.52'}, |
| 43 {at: 1, is: '0.2'}, |
| 44 {at: 1.5, is: '0'}, |
| 45 ]); |
| 46 |
| 47 assertInterpolation({ |
| 48 property: 'opacity', |
| 49 from: 'inherit', |
| 50 to: '0.2', |
| 51 }, [ |
| 52 {at: -0.3, is: '0.98'}, |
| 53 {at: 0, is: '0.8'}, |
| 54 {at: 0.3, is: '0.62'}, |
| 55 {at: 0.6, is: '0.44'}, |
| 56 {at: 1, is: '0.2'}, |
| 57 {at: 1.5, is: '0'}, |
| 58 ]); |
| 59 |
| 60 assertInterpolation({ |
| 61 property: 'opacity', |
| 62 from: 'unset', |
| 63 to: '0.2', |
| 64 }, [ |
| 65 {at: -0.3, is: '1'}, |
| 66 {at: 0, is: '1'}, |
| 67 {at: 0.3, is: '0.76'}, |
| 68 {at: 0.6, is: '0.52'}, |
| 69 {at: 1, is: '0.2'}, |
| 70 {at: 1.5, is: '0'}, |
| 71 ]); |
| 72 |
| 73 assertInterpolation({ |
| 74 property: 'opacity', |
19 from: '0', | 75 from: '0', |
20 to: '1' | 76 to: '1' |
21 }, [ | 77 }, [ |
22 {at: -0.3, is: '0'}, // CSS opacity is [0-1]. | 78 {at: -0.3, is: '0'}, // CSS opacity is [0-1]. |
23 {at: 0, is: '0'}, | 79 {at: 0, is: '0'}, |
24 {at: 0.3, is: '0.3'}, | 80 {at: 0.3, is: '0.3'}, |
25 {at: 0.6, is: '0.6'}, | 81 {at: 0.6, is: '0.6'}, |
26 {at: 1, is: '1'}, | 82 {at: 1, is: '1'}, |
27 {at: 1.5, is: '1'} | 83 {at: 1.5, is: '1'} |
28 ]); | 84 ]); |
29 </script> | 85 </script> |
30 </body> | 86 </body> |
OLD | NEW |