tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

transform-interpolation-002.html (3957B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>transform interpolation</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-transforms/#transform-property">
      5 <meta name="assert" content="transform supports animation as a transform list">
      6 
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/css/support/interpolation-testcommon.js"></script>
     10 
     11 <style>
     12 .target {
     13  color: white;
     14  width: 100px;
     15  height: 100px;
     16  background-color: black;
     17  display: inline-block;
     18  overflow: hidden;
     19 }
     20 .expected {
     21  background-color: green;
     22 }
     23 .target > div {
     24  width: 10px;
     25  height: 10px;
     26  display: inline-block;
     27  background: orange;
     28  margin: 1px;
     29 }
     30 .test {
     31  overflow: hidden;
     32 }
     33 </style>
     34 
     35 <body>
     36  <template id="target-template">
     37    <div></div>
     38  </template>
     39 </body>
     40 
     41 <script>
     42 // Scale
     43 test_interpolation({
     44  property: 'transform',
     45  from: 'scale(10, 5)',
     46  to: 'scale(20, 9)'
     47 }, [
     48  {at: -1, expect: 'scale(0, 1)'},
     49  {at: 0, expect: 'scale(10, 5)'},
     50  {at: 0.25, expect: 'scale(12.5, 6)'},
     51  {at: 0.75, expect: 'scale(17.5, 8)'},
     52  {at: 1, expect: 'scale(20, 9)'},
     53  {at: 2, expect: 'scale(30, 13)'},
     54 ]);
     55 test_interpolation({
     56  property: 'transform',
     57  from: 'scaleX(10)',
     58  to: 'scaleX(20)'
     59 }, [
     60  {at: -1, expect: 'scaleX(0)'},
     61  {at: 0, expect: 'scaleX(10)'},
     62  {at: 0.25, expect: 'scaleX(12.5)'},
     63  {at: 0.75, expect: 'scaleX(17.5)'},
     64  {at: 1, expect: 'scaleX(20)'},
     65  {at: 2, expect: 'scaleX(30)'},
     66 ]);
     67 test_interpolation({
     68  property: 'transform',
     69  from: 'scaleY(5)',
     70  to: 'scaleY(9)'
     71 }, [
     72  {at: -1, expect: 'scaleY(1)'},
     73  {at: 0, expect: 'scaleY(5)'},
     74  {at: 0.25, expect: 'scaleY(6)'},
     75  {at: 0.75, expect: 'scaleY(8)'},
     76  {at: 1, expect: 'scaleY(9)'},
     77  {at: 2, expect: 'scaleY(13)'},
     78 ]);
     79 test_interpolation({
     80  property: 'transform',
     81  from: 'scaleZ(1)',
     82  to: 'scaleZ(2)'
     83 }, [
     84  {at: -1, expect: 'scaleZ(0)'},
     85  {at: 0, expect: 'scaleZ(1)'},
     86  {at: 0.25, expect: 'scaleZ(1.25)'},
     87  {at: 0.75, expect: 'scaleZ(1.75)'},
     88  {at: 1, expect: 'scaleZ(2)'},
     89  {at: 2, expect: 'scaleZ(3)'},
     90 ]);
     91 test_interpolation({
     92  property: 'transform',
     93  from: 'scale3d(10, 0.5, 1)',
     94  to: 'scale3d(20, 1, 2)'
     95 }, [
     96  {at: -1, expect: 'scale3d(0, 0, 0)'},
     97  {at: 0, expect: 'scale3d(10, 0.5, 1)'},
     98  {at: 0.25, expect: 'scale3d(12.5, 0.625, 1.25)'},
     99  {at: 0.75, expect: 'scale3d(17.5, 0.875, 1.75)'},
    100  {at: 1, expect: 'scale3d(20, 1, 2)'},
    101  {at: 2, expect: 'scale3d(30, 1.5, 3)'},
    102 ]);
    103 test_interpolation({
    104  property: 'transform',
    105  from: 'scaleX(0)',
    106  to: 'scaleY(0)',
    107 }, [
    108  {at: -1, expect: 'scale(-1, 2)'},
    109  {at: 0, expect: 'scale(0, 1)'},
    110  {at: 0.25, expect: 'scale(0.25, 0.75)'},
    111  {at: 0.75, expect: 'scale(0.75, 0.25)'},
    112  {at: 1, expect: 'scale(1, 0)'},
    113  {at: 2, expect: 'scale(2, -1)'},
    114 ]);
    115 test_interpolation({
    116  property: 'transform',
    117  from: 'none',
    118  to: 'scale3d(2, 3, 5)'
    119 }, [
    120  {at: -1, expect: 'scale3d(0, -1, -3)'},
    121  {at: 0, expect: 'scale3d(1, 1, 1)'},
    122  {at: 0.25, expect: 'scale3d(1.25, 1.5, 2)'},
    123  {at: 0.75, expect: 'scale3d(1.75, 2.5, 4)'},
    124  {at: 1, expect: 'scale3d(2, 3, 5)'},
    125  {at: 2, expect: 'scale3d(3, 5, 9)'},
    126 ]);
    127 test_interpolation({
    128  property: 'transform',
    129  from: 'scale3d(2, 3, 5)',
    130  to: 'none'
    131 }, [
    132  {at: -1, expect: 'scale3d(3, 5, 9)'},
    133  {at: 0, expect: 'scale3d(2, 3, 5)'},
    134  {at: 0.25, expect: 'scale3d(1.75, 2.5, 4)'},
    135  {at: 0.75, expect: 'scale3d(1.25, 1.5, 2)'},
    136  {at: 1, expect: 'scale3d(1, 1, 1)'},
    137  {at: 2, expect: 'scale3d(0, -1, -3)'},
    138 ]);
    139 test_interpolation({
    140  property: 'transform',
    141  from: 'scaleX(10) scaleY(0.5) scaleZ(1)',
    142  to: 'scaleX(20) scaleY(1) scaleZ(2)'
    143 }, [
    144  {at: -1, expect: 'scaleX(0) scaleY(0) scaleZ(0)'},
    145  {at: 0, expect: 'scaleX(10) scaleY(0.5) scaleZ(1)'},
    146  {at: 0.25, expect: 'scaleX(12.5) scaleY(0.625) scaleZ(1.25)'},
    147  {at: 0.75, expect: 'scaleX(17.5) scaleY(0.875) scaleZ(1.75)'},
    148  {at: 1, expect: 'scaleX(20) scaleY(1) scaleZ(2)'},
    149  {at: 2, expect: 'scaleX(30) scaleY(1.5) scaleZ(3)'},
    150 ]);
    151 </script>