File: bezier.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 (38 lines) | stat: -rw-r--r-- 869 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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Bezier Animation</title>
    <script src="../dist/zrender.js"></script>
</head>
<body>
    <div id="main" style="width:1000px;height:600px;"></div>
    <script type="text/javascript">
        var zr = zrender.init(document.getElementById('main'));

        var curve = new zrender.BezierCurve({
            position: [0, 0],
            scale: [1, 1],
            shape: {
                x1: 10,
                y1: 400,
                cpx1: 0,
                cpy1: 0,
                cpx2: 0,
                cpy2: 0,
                x2: 300,
                y2: 30
            },
            draggable: true
        });

        zr.add(curve);

        curve.animateTo({
            shape: {
                percent: 0
            }
        }, { duration: 2000 });
    </script>
</body>
</html>