File: animation-keyframe-easing.html

package info (click to toggle)
node-zrender 5.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,544 kB
  • sloc: javascript: 1,259; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download | duplicates (2)
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Animation Keyframe Easing</title>
    <script src="../dist/zrender.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
        html, body, #main {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <div id="main"></div>
    <script type="text/javascript">
        var main = document.getElementById('main');
        // 初始化zrender
        var zr = zrender.init(main);

        for (let i = 0; i < 10; i++) {
            var circle = new zrender.Circle({
                x: 100,
                y: i * 80,
                shape: {
                    cx: 30,
                    cy: 30,
                    r: 30
                },
                style: {
                    fill: 'red',
                    lineWidth: 5
                },
            });
            zr.add(circle);

            circle.animate('', true)
                .when(500, {
                    x: 800
                }, 'sinusoidalInOut')
                .when(1000, {
                    x: 100
                }, 'sinusoidalInOut')
                .delay(i * 100)
                .start();
        }
    </script>
</body>
</html>