File: svg-image-opacity.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,504 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>Image</title>
    <script src="./lib/config.js"></script>
    <script src="../dist/zrender.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
    <div>fix
        <a href="https://github.com/apache/incubator-echarts/issues/13762" target="_blank">apache/incubator-echarts#13762</a>
    </div>
    <div id="main" style="width:1000px;height:800px;"></div>
    <script type="text/javascript">
    // initializes zrender
    var zr = zrender.init(document.getElementById('main'), {
        renderer: window.__ZRENDER__DEFAULT__RENDERER__ || 'svg'
    });

    var imageSize = 50;
    [1, .8, .5, .2, 0].forEach(function(opacity, i) {
        zr.add(new zrender.Image({
            position: [i * imageSize, i * imageSize],
            scale: [1, 1],
            style: {
                x: 0,
                y: 0,
                image: 'https://echarts.apache.org/zh/images/favicon.png',
                width: imageSize,
                height: imageSize,
                opacity: opacity
            },
            textContent: new zrender.Text({
                style: {
                    text: `opacity: ${opacity}`,
                    fontWeight: 'bold',
                    fontSize: 12
                }
            }),
            textConfig: {
                position: 'right'
            },
            draggable: true
        }));
    });
    </script>

</body>
</html>