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>
|