summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/motion/animation/offset-path-interpolation-006.html
blob: a19908e4fffc2383a940e04ef0c00c486085cfee (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
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>offset-distance basic-shape interpolation</title>
    <link rel="author" title="Daniil Sakhapov" href="mailto:sakhapov@chromium.org">
    <link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
    <meta name="assert" content="offset-path basic shape supports animation.">
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/css/support/interpolation-testcommon.js"></script>
  </head>
  <style>
    .parent {
      offset-path: ellipse(10% 10%);
    }
    .target {
      offset-path: circle(10px);
    }
  </style>
  <body>
    <script>
      'use strict';

      test_no_interpolation({
        property: 'offset-path',
        from: "circle(10px)",
        to: "inset(20px)",
      });

      test_no_interpolation({
        property: 'offset-path',
        from: "ellipse(at center)",
        to: "none",
      });

      // Neutral keyframes use the inline style.
      test_interpolation({
        property: 'offset-path',
        from: neutralKeyframe,
        to: 'circle(20px)',
      }, [
        {at: -0.3, expect: 'circle(7px)'},
        {at: 0, expect: 'circle(10px)'},
        {at: 0.3, expect: 'circle(13px)'},
        {at: 0.6, expect: 'circle(16px)'},
        {at: 1, expect: 'circle(20px)'},
        {at: 1.5, expect: 'circle(25px)'},
      ]);

      // No interpolation to an ellipse from the initial value 'none'.
      test_no_interpolation({
        property: 'offset-path',
        from: 'initial',
        to: 'ellipse()',
      });

      // 'inherit' keyframes use the parent style.
      test_interpolation({
        property: 'offset-path',
        from: 'inherit',
        to: 'ellipse(40% 50% at 25% 25%)',
      }, [
        {at: -0.3, expect: 'ellipse(1% 0% at 57.5% 57.5%)'},
        {at: 0, expect: 'ellipse(10% 10% at 50% 50%)'},
        {at: 0.3, expect: 'ellipse(19% 22% at 42.5% 42.5%)'},
        {at: 0.6, expect: 'ellipse(28% 34% at 35% 35%)'},
        {at: 1, expect: 'ellipse(40% 50% at 25% 25%)'},
        {at: 1.5, expect: 'ellipse(55% 70% at 12.5% 12.5%)'},
      ]);

      // No interpolation to an inset from the initial value 'none'.
      test_no_interpolation({
        property: 'offset-path',
        from: 'unset',
        to: 'inset(10%)',
      });

      // No interpolation to a rect from the initial value 'none'.
      test_no_interpolation({
        property: 'offset-path',
        from: 'none',
        to: 'rect(10px 10px 10px 10px)',
      });

      // Interpolation between shapes.
      test_interpolation({
        property: 'offset-path',
        from: 'inset(10px)',
        to: 'inset(20px round 50%)'
      }, [
        {at: -1, expect: 'inset(0px round 0%)'},
        {at: 0, expect: 'inset(10px round 0%)'},
        {at: 0.125, expect: 'inset(11.25px round 6.25%)'},
        {at: 0.875, expect: 'inset(18.75px round 43.75%)'},
        {at: 1, expect: 'inset(20px round 50%)'},
        {at: 2, expect: 'inset(30px round 100%)'},
      ]);

      test_interpolation({
        property: 'offset-path',
        from: 'xywh(5px 5px 150% 150%)',
        to: 'xywh(10px 10px 100% 100%)'
      }, [
        {at: -1, expect: 'xywh(0px 0px 200% 200%)'},
        {at: 0, expect: 'xywh(5px 5px 150% 150%)'},
        {at: 0.125, expect: 'xywh(5.63px 5.63px 143.75% 143.75% )'},
        {at: 0.875, expect: 'xywh(9.38px 9.38px 106.25% 106.25%)'},
        {at: 1, expect: 'xywh(10px 10px 100% 100%)'},
        {at: 2, expect: 'xywh(15px 15px 50% 50%)'},
      ]);

      // No interpolation between different radius keywords.
      test_no_interpolation({
        property: 'offset-path',
        from: 'circle(farthest-side)',
        to: 'circle(closest-side)'
      });
      test_no_interpolation({
        property: 'offset-path',
        from: 'ellipse(closest-side farthest-side)',
        to: 'ellipse(closest-side closest-side)'
      });
    </script>
  </body>
</html>