summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-transforms/animation/transform-interpolation-002.html
blob: fec0de1f53544dd4314629fde9fe73bc1bfa1596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<meta charset="UTF-8">
<title>transform interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-transforms/#transform-property">
<meta name="assert" content="transform supports animation as a transform list">

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>

<style>
.target {
  color: white;
  width: 100px;
  height: 100px;
  background-color: black;
  display: inline-block;
  overflow: hidden;
}
.expected {
  background-color: green;
}
.target > div {
  width: 10px;
  height: 10px;
  display: inline-block;
  background: orange;
  margin: 1px;
}
.test {
  overflow: hidden;
}
</style>

<body>
  <template id="target-template">
    <div></div>
  </template>
</body>

<script>
// Scale
test_interpolation({
  property: 'transform',
  from: 'scale(10, 5)',
  to: 'scale(20, 9)'
}, [
  {at: -1, expect: 'scale(0, 1)'},
  {at: 0, expect: 'scale(10, 5)'},
  {at: 0.25, expect: 'scale(12.5, 6)'},
  {at: 0.75, expect: 'scale(17.5, 8)'},
  {at: 1, expect: 'scale(20, 9)'},
  {at: 2, expect: 'scale(30, 13)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scaleX(10)',
  to: 'scaleX(20)'
}, [
  {at: -1, expect: 'scaleX(0)'},
  {at: 0, expect: 'scaleX(10)'},
  {at: 0.25, expect: 'scaleX(12.5)'},
  {at: 0.75, expect: 'scaleX(17.5)'},
  {at: 1, expect: 'scaleX(20)'},
  {at: 2, expect: 'scaleX(30)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scaleY(5)',
  to: 'scaleY(9)'
}, [
  {at: -1, expect: 'scaleY(1)'},
  {at: 0, expect: 'scaleY(5)'},
  {at: 0.25, expect: 'scaleY(6)'},
  {at: 0.75, expect: 'scaleY(8)'},
  {at: 1, expect: 'scaleY(9)'},
  {at: 2, expect: 'scaleY(13)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scaleZ(1)',
  to: 'scaleZ(2)'
}, [
  {at: -1, expect: 'scaleZ(0)'},
  {at: 0, expect: 'scaleZ(1)'},
  {at: 0.25, expect: 'scaleZ(1.25)'},
  {at: 0.75, expect: 'scaleZ(1.75)'},
  {at: 1, expect: 'scaleZ(2)'},
  {at: 2, expect: 'scaleZ(3)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scale3d(10, 0.5, 1)',
  to: 'scale3d(20, 1, 2)'
}, [
  {at: -1, expect: 'scale3d(0, 0, 0)'},
  {at: 0, expect: 'scale3d(10, 0.5, 1)'},
  {at: 0.25, expect: 'scale3d(12.5, 0.625, 1.25)'},
  {at: 0.75, expect: 'scale3d(17.5, 0.875, 1.75)'},
  {at: 1, expect: 'scale3d(20, 1, 2)'},
  {at: 2, expect: 'scale3d(30, 1.5, 3)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scaleX(0)',
  to: 'scaleY(0)',
}, [
  {at: -1, expect: 'scale(-1, 2)'},
  {at: 0, expect: 'scale(0, 1)'},
  {at: 0.25, expect: 'scale(0.25, 0.75)'},
  {at: 0.75, expect: 'scale(0.75, 0.25)'},
  {at: 1, expect: 'scale(1, 0)'},
  {at: 2, expect: 'scale(2, -1)'},
]);
test_interpolation({
  property: 'transform',
  from: 'none',
  to: 'scale3d(2, 3, 5)'
}, [
  {at: -1, expect: 'scale3d(0, -1, -3)'},
  {at: 0, expect: 'scale3d(1, 1, 1)'},
  {at: 0.25, expect: 'scale3d(1.25, 1.5, 2)'},
  {at: 0.75, expect: 'scale3d(1.75, 2.5, 4)'},
  {at: 1, expect: 'scale3d(2, 3, 5)'},
  {at: 2, expect: 'scale3d(3, 5, 9)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scale3d(2, 3, 5)',
  to: 'none'
}, [
  {at: -1, expect: 'scale3d(3, 5, 9)'},
  {at: 0, expect: 'scale3d(2, 3, 5)'},
  {at: 0.25, expect: 'scale3d(1.75, 2.5, 4)'},
  {at: 0.75, expect: 'scale3d(1.25, 1.5, 2)'},
  {at: 1, expect: 'scale3d(1, 1, 1)'},
  {at: 2, expect: 'scale3d(0, -1, -3)'},
]);
test_interpolation({
  property: 'transform',
  from: 'scaleX(10) scaleY(0.5) scaleZ(1)',
  to: 'scaleX(20) scaleY(1) scaleZ(2)'
}, [
  {at: -1, expect: 'scaleX(0) scaleY(0) scaleZ(0)'},
  {at: 0, expect: 'scaleX(10) scaleY(0.5) scaleZ(1)'},
  {at: 0.25, expect: 'scaleX(12.5) scaleY(0.625) scaleZ(1.25)'},
  {at: 0.75, expect: 'scaleX(17.5) scaleY(0.875) scaleZ(1.75)'},
  {at: 1, expect: 'scaleX(20) scaleY(1) scaleZ(2)'},
  {at: 2, expect: 'scaleX(30) scaleY(1.5) scaleZ(3)'},
]);
</script>