OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <style> |
| 3 |
| 4 .target { |
| 5 font-size: 16px; |
| 6 width: 60px; |
| 7 height: 60px; |
| 8 display: inline-block; |
| 9 border: 2px solid black; |
| 10 margin-right: 2px; |
| 11 } |
| 12 .replica { |
| 13 background-color: green; |
| 14 margin-right: 15px; |
| 15 } |
| 16 |
| 17 </style> |
| 18 <body> |
| 19 <script src="resources/interpolation-test.js"></script> |
| 20 <script> |
| 21 |
| 22 function vw(x) { |
| 23 return (x * window.innerWidth / 100); |
| 24 } |
| 25 |
| 26 function calc(x) { |
| 27 return Math.max(16 + (vw(10) - 16) * x, 0).toFixed(2) + "px"; |
| 28 } |
| 29 |
| 30 assertInterpolation({ |
| 31 property: 'width', |
| 32 from: '1em', |
| 33 to: '10vw' |
| 34 }, [ |
| 35 {at: -0.3, is: calc(-0.3)}, |
| 36 {at: 0, is: calc(0)}, |
| 37 {at: 0.3, is: calc(0.3)}, |
| 38 {at: 0.6, is: calc(0.6)}, |
| 39 {at: 1, is: calc(1)}, |
| 40 {at: 1.5, is: calc(1.5)} |
| 41 ]); |
| 42 </script> |
| 43 </body> |
OLD | NEW |