<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/[email protected]/konva.min.js"></script>
<meta charset="utf-8" />
<title>Konva Zoom Image on Hover Demo</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f0f0f0;
}
</style>
</head>
<body>
<div id="container"></div>
<script>
var width = window.innerWidth;
var height = window.innerHeight;
//imageObj.src = 'https://konvajs.org/assets/yoda.jpg';
const json = '{"attrs":{"width":2382,"height":1684,"draggable":true},"className":"Stage","children":[{"attrs":{"hitGraphEnabled":false},"className":"Layer","children":[{"attrs":{},"className":"Image"},{"attrs":{"source":"https://konvajs.org/assets/yoda.jpg"},"className":"Image"}]},{"attrs":{},"className":"Layer","children":[{"attrs":{"draggable":true,"x":306,"y":303,"transformsEnabled":"position"},"className":"Group","children":[{"attrs":{"radius":20,"stroke":"#231fff","strokeWidth":4,"fill":"#ffffff"},"className":"Circle"},{"attrs":{"text":"1","fontSize":14,"originX":"center","originY":"center","fill":"#231fff","x":-5,"y":-5},"className":"Text"},{"attrs":{"data":"M.91,0H29.09A.91.91,0,0,1,30,.91v243a.88.88,0,0,1-.26.63L15.65,258.86a.9.9,0,0,1-1.3,0L.26,244.52a.88.88,0,0,1-.26-.63V.91A.91.91,0,0,1,.91,0Z","originX":"center","originY":"bottom","x":10,"y":15,"angle":-30,"fill":"#231fff","scaleX":0.15,"scaleY":0.15,"rotation":-30},"className":"Path"}]},{"attrs":{"draggable":true,"x":490,"y":557,"transformsEnabled":"position"},"className":"Group","children":[{"attrs":{"radius":20,"stroke":"#231fff","strokeWidth":4,"fill":"#ffffff"},"className":"Circle"},{"attrs":{"text":"2","fontSize":14,"originX":"center","originY":"center","fill":"#231fff","x":-5,"y":-5},"className":"Text"},{"attrs":{"data":"M.91,0H29.09A.91.91,0,0,1,30,.91v243a.88.88,0,0,1-.26.63L15.65,258.86a.9.9,0,0,1-1.3,0L.26,244.52a.88.88,0,0,1-.26-.63V.91A.91.91,0,0,1,.91,0Z","originX":"center","originY":"bottom","x":10,"y":15,"angle":-30,"fill":"#231fff","scaleX":0.15,"scaleY":0.15,"rotation":-30},"className":"Path"}]}]}]}';
const stage = Konva.Node.create(json, 'container');
stage.find('Image').forEach((node) => {
const img = new Image();
img.src = node.getAttr('source');
img.onload = () => {
node.image(img);
stage.batchDraw();
}
})
console.log(stage.toJSON())
</script>
</body>
</html>
dgiot-topo通道是影子设备与前端组态页面之间的桥接通道
版权申诉
182 浏览量
2023-10-15
14:58:47
上传
评论
收藏 24KB ZIP 举报
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6746
最新资源
- IMG_0796.PNG
- Hyper+Lightning5+SDXL大模型比较推荐
- 基于matlab 小波神经网络的时间序列预测-短时交通流量预测源代码+详细教程
- 基于matlab 思维进化算法优化BP神经网络-非线性函数拟合源代码+详细教程
- macOS植物大战僵尸3D 苹果电脑版.7z
- 基于matlab 极限学习机在回归拟合及分类问题中的应用研究-对比实验源代码+详细教程
- ItemApplicationTest.java
- (PC+WAP)公司注册财务会计类网站pbootcms模板 蓝色律师公证网站源码下载.zip
- 高校校园招聘系统 JAVA+Spring+SpringMVC+MyBatis
- 个人发卡源码,发卡系统,二次元发卡系统,二次元发卡源码,发卡程序,动漫发卡,PHP发卡源码,异次元发卡
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈