-
Notifications
You must be signed in to change notification settings - Fork 0
/
16-path.html
77 lines (53 loc) · 1.91 KB
/
16-path.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="svg270/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="svg270/themes/icon.css">
<script type="text/javascript" src="svg270/jquery.min.js"></script>
<script type="text/javascript" src="svg270/jquery.easyui.min.js"></script>
<!--高版本-->
<script src="svg311/node_modules/@svgdotjs/svg.js/dist/svg.js"></script>
<script src="svg311/node_modules/@svgdotjs/svg.panzoom.js/dist/svg.panzoom.js"></script>
<script src="svg311/node_modules/@svgdotjs/svg.draggable.js/dist/svg.draggable.js"></script>
<!-- 低版本 -->
<!-- <script src="svg270/svg.min.js"></script>
<script src="svg270/svg.panzoom.js"></script>
<script src="svg270/svg.draggable.js"></script> -->
</head>
<style>
</style>
<!--
-->
<body>
<div>
<div style="">我是一个画布视窗</div>
<div id="drawing" style="border:1px solid green;width: 800px;height: 600px;">
</div>
</div>
</body>
<script>
var draw = SVG().addTo('#drawing').size("100%","100%");
//draw.path("M100 100 H200 V300 L 400 250").css({"fill":"none","stroke":"green","stroke-width":"1mm"});
//draw.path('M 100 200 L 300 100 L 200 300').css({"fill":"none","stroke":"green","stroke-width":"1mm"});
draw.path('M 100 200 L 300 100').css("fill:none;stroke:#000000;stroke-width:0.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:5,5;stroke-dashoffset:0;stroke-opacity:1");
function createUUID() {
var x = 13 * Math.floor(Math.random() * 1000) + "-" + 7 * Math.floor(Math.random() * 100);
return "id_" + x;
}
/**
* 生成随机颜色
*/
function getRandomColor() {
var x = getRandomInteger();
return "#" + x;
}
/**
* 生成随机数
*/
function getRandomInteger() {
var x = Math.floor(Math.random() * 9) + "" + Math.floor(Math.random() * 9) + "" + Math.floor(Math.random() * 9);
return x;
}
</script>
</html>