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
|
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
display: inline-block;
}
.parent {
flood-opacity: 0.8;
}
.target {
flood-opacity: 0.6;
}
svg {
background: black;
}
rect {
fill: black;
filter: url(#test);
}
</style>
<body>
<template id="target-template">
<svg width="10" height="100">
<defs>
<filter id="test">
<feFlood x="0" y="0" width="10" height="100" flood-color="blue" class="target" />
</filter>
</defs>
<rect width="10" height="100"></rect>
</svg>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'flood-opacity',
from: '',
to: '0.4',
}, [
{at: -1, is: '0.8'},
{at: -0.25, is: '0.65'},
{at: 0, is: '0.6'},
{at: 0.25, is: '0.55'},
{at: 1, is: '0.4'},
{at: 1.25, is: '0.35'},
{at: 2, is: '0.2'},
]);
assertInterpolation({
property: 'flood-opacity',
from: 'initial',
to: '0.4',
}, [
{at: -1, is: '1'},
{at: -0.25, is: '1'},
{at: 0, is: '1'},
{at: 0.25, is: '0.85'},
{at: 1, is: '0.4'},
{at: 1.25, is: '0.25'},
{at: 2, is: '0'},
]);
assertInterpolation({
property: 'flood-opacity',
from: 'inherit',
to: '0.4',
}, [
{at: -1, is: '1'},
{at: -0.25, is: '0.9'},
{at: 0, is: '0.8'},
{at: 0.25, is: '0.7'},
{at: 1, is: '0.4'},
{at: 1.25, is: '0.3'},
{at: 2, is: '0'},
]);
assertInterpolation({
property: 'flood-opacity',
from: 'unset',
to: '0.4',
}, [
{at: -1, is: '1'},
{at: -0.25, is: '1'},
{at: 0, is: '1'},
{at: 0.25, is: '0.85'},
{at: 1, is: '0.4'},
{at: 1.25, is: '0.25'},
{at: 2, is: '0'},
]);
assertInterpolation({
property: 'flood-opacity',
from: '0.25',
to: '0.75'
}, [
{at: -1, is: '0'}, // SVG Opacity ranges from 0.0 to 1.0
{at: -0.25, is: '0.125'},
{at: 0, is: '0.25'},
{at: 0.25, is: '0.375'},
{at: 1, is: '0.75'},
{at: 1.25, is: '0.875'},
{at: 2, is: '1'}, // SVG Opacity ranges from 0.0 to 1.0
]);
</script>
</body>
|