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
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>offset-distance composition</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-distance-property">
<meta name="assert" content="offset-distance supports animation.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<body>
<script>
// TODO(ericwilligers) Support additive animation for path strings crbug.com/699308
// Ray paths compose.
test_composition({
property: 'offset-path',
underlying: 'ray(20deg sides)',
addFrom: 'ray(10deg sides)',
addTo: 'ray(20deg sides)',
}, [
{at: -0.3, expect: 'ray(27deg sides)'},
{at: 0, expect: 'ray(30deg sides)'},
{at: 0.3, expect: 'ray(33deg sides)'},
{at: 0.6, expect: 'ray(36deg sides)'},
{at: 1, expect: 'ray(40deg sides)'},
{at: 1.5, expect: 'ray(45deg sides)'},
]);
// Ray paths without contain don't compose with underlying contain.
test_composition({
property: 'offset-path',
underlying: 'ray(20deg closest-corner contain)',
addFrom: 'ray(10deg closest-corner)',
addTo: 'ray(20deg closest-corner)',
}, [
{at: -0.3, expect: 'ray(7deg closest-corner)'},
{at: 0, expect: 'ray(10deg closest-corner)'},
{at: 0.3, expect: 'ray(13deg closest-corner)'},
{at: 0.6, expect: 'ray(16deg closest-corner)'},
{at: 1, expect: 'ray(20deg closest-corner)'},
{at: 1.5, expect: 'ray(25deg closest-corner)'},
]);
// Ray paths don't compose when underlying has different size.
test_composition({
property: 'offset-path',
underlying: 'ray(20deg closest-side)',
addFrom: 'ray(10deg closest-corner)',
addTo: 'ray(20deg closest-corner)',
}, [
{at: -0.3, expect: 'ray(7deg closest-corner)'},
{at: 0, expect: 'ray(10deg closest-corner)'},
{at: 0.3, expect: 'ray(13deg closest-corner)'},
{at: 0.6, expect: 'ray(16deg closest-corner)'},
{at: 1, expect: 'ray(20deg closest-corner)'},
{at: 1.5, expect: 'ray(25deg closest-corner)'},
]);
// Ray contain paths compose with underlying contain.
test_composition({
property: 'offset-path',
underlying: 'ray(20deg farthest-side contain)',
addFrom: 'ray(190deg farthest-side contain)',
addTo: 'ray(20deg farthest-side contain)',
}, [
{at: -0.3, expect: 'ray(261deg farthest-side contain)'},
{at: 0, expect: 'ray(210deg farthest-side contain)'},
{at: 0.3, expect: 'ray(159deg farthest-side contain)'},
{at: 0.6, expect: 'ray(108deg farthest-side contain)'},
{at: 1, expect: 'ray(40deg farthest-side contain)'},
{at: 1.5, expect: 'ray(-45deg farthest-side contain)'},
]);
// When we can't interpolate, we can't compose.
test_composition({
property: 'offset-path',
underlying: 'ray(20deg farthest-corner)',
addFrom: 'ray(190deg farthest-corner contain)',
addTo: 'ray(20deg farthest-corner)',
}, [
{at: -0.3, expect: 'ray(190deg farthest-corner contain)'},
{at: 0, expect: 'ray(190deg farthest-corner contain)'},
{at: 0.3, expect: 'ray(190deg farthest-corner contain)'},
{at: 0.6, expect: 'ray(40deg farthest-corner)'},
{at: 1, expect: 'ray(40deg farthest-corner)'},
{at: 1.5, expect: 'ray(40deg farthest-corner)'},
]);
test_composition({
property: 'offset-path',
underlying: 'ray(20deg sides)',
replaceFrom: 'ray(190deg sides contain)',
addTo: 'ray(20deg sides)',
}, [
{at: -0.3, expect: 'ray(190deg sides contain)'},
{at: 0, expect: 'ray(190deg sides contain)'},
{at: 0.3, expect: 'ray(190deg sides contain)'},
{at: 0.6, expect: 'ray(40deg sides)'},
{at: 1, expect: 'ray(40deg sides)'},
{at: 1.5, expect: 'ray(40deg sides)'},
]);
// Ray paths compose with underlying.
test_composition({
property: 'offset-path',
underlying: 'ray(20deg closest-side)',
addFrom: 'ray(10deg closest-side)',
replaceTo: 'ray(10deg closest-side)',
}, [
{at: -0.3, expect: 'ray(36deg closest-side)'},
{at: 0, expect: 'ray(30deg closest-side)'},
{at: 0.3, expect: 'ray(24deg closest-side)'},
{at: 0.6, expect: 'ray(18deg closest-side)'},
{at: 1, expect: 'ray(10deg closest-side)'},
{at: 1.5, expect: 'ray(0deg closest-side)'},
]);
</script>
</body>
|