-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathbackground-color-interpolation.html
More file actions
122 lines (112 loc) · 3.06 KB
/
background-color-interpolation.html
File metadata and controls
122 lines (112 loc) · 3.06 KB
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
<!DOCTYPE html>
<meta charset="UTF-8">
<link rel="help" href="https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-backgrounds-3/#background-color">
<meta name="test" content="background-color supports animation as a <color>">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
background-color: #eee;
}
.target {
width: 60px;
height: 60px;
display: inline-block;
border: 2px solid black;
margin-right: 2px;
color: rgba(0, 0, 255, 0.5);
background-color: black;
}
.expected {
margin-right: 15px;
}
</style>
<body></body>
<script>
test_interpolation({
property: 'background-color',
from: neutralKeyframe,
to: 'green',
}, [
{at: -0.3, expect: 'rgb(0, 0, 0)'},
{at: 0, expect: 'rgb(0, 0, 0)'},
{at: 0.3, expect: 'rgb(0, 38, 0)'},
{at: 0.6, expect: 'rgb(0, 77, 0)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'background-color',
from: 'initial',
to: 'green',
}, [
{at: -0.3, expect: 'rgba(0, 0, 0, 0)'},
{at: 0, expect: 'rgba(0, 0, 0, 0)'},
{at: 0.3, expect: 'rgba(0, 128, 0, 0.3)'},
{at: 0.6, expect: 'rgba(0, 128, 0, 0.6)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'background-color',
from: 'inherit',
to: 'green',
}, [
{at: -0.3, expect: 'rgb(255, 255, 255)'},
{at: 0, expect: 'rgb(238, 238, 238)'},
{at: 0.3, expect: 'rgb(167, 205, 167)'},
{at: 0.6, expect: 'rgb(95, 172, 95)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 73, 0)'},
]);
test_interpolation({
property: 'background-color',
from: 'unset',
to: 'green',
}, [
{at: -0.3, expect: 'rgba(0, 0, 0, 0)'},
{at: 0, expect: 'rgba(0, 0, 0, 0)'},
{at: 0.3, expect: 'rgba(0, 128, 0, 0.3)'},
{at: 0.6, expect: 'rgba(0, 128, 0, 0.6)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'background-color',
from: 'white',
to: 'orange',
}, [
{at: -0.3, expect: 'white'},
{at: 0, expect: 'white'},
{at: 0.3, expect: 'rgb(255, 228, 179)'},
{at: 0.6, expect: 'rgb(255, 201, 102)'},
{at: 1, expect: 'orange'},
{at: 1.5, expect: 'rgb(255, 120, 0)'},
]);
test_interpolation({
property: 'background-color',
from: 'transparent',
to: 'green',
}, [
{at: -0.3, expect: 'rgba(0, 0, 0, 0)'},
{at: 0, expect: 'rgba(0, 0, 0, 0)'},
{at: 0.3, expect: 'rgba(0, 128, 0, 0.3)'},
{at: 0.6, expect: 'rgba(0, 128, 0, 0.6)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'background-color',
from: 'currentcolor',
to: 'rgba(0, 255, 0, 0.75)',
}, [
{at: -0.5, expect: 'rgba(0, 0, 255, 0.38)'},
{at: 0, expect: 'rgba(0, 0, 255, 0.5)'},
{at: 0.25, expect: 'rgba(0, 85, 170, 0.56)'},
{at: 0.5, expect: 'rgba(0, 153, 102, 0.63)'},
{at: 0.75, expect: 'rgba(0, 208, 47, 0.69)'},
{at: 1, expect: 'rgba(0, 255, 0, 0.75)'},
{at: 1.5, expect: 'rgba(0, 255, 0, 0.88)'},
]);
</script>