1 | <!DOCTYPE html>
|
2 | <html>
|
3 | <head>
|
4 | <style>
|
5 | body {
|
6 | margin: auto;
|
7 | display: table;
|
8 | }
|
9 | svg {
|
10 | margin-top: 10px;
|
11 | }
|
12 | </style>
|
13 | </head>
|
14 | <body>
|
15 | <svg width="420" height="440"></svg>
|
16 | <script src="https://unpkg.com/d3-selection@1.1.0/build/d3-selection.min.js"></script>
|
17 | <script src="../build/shape2path.min.js"></script>
|
18 | <script>
|
19 | var svg = d3.select("svg");
|
20 |
|
21 | svg.append("circle")
|
22 | .attr("cx", 20)
|
23 | .attr("cy", 20)
|
24 | .attr("r", 20);
|
25 |
|
26 | svg.append("path")
|
27 | .attr("transform", "translate(45, 0)")
|
28 | .attr("d", shape2path.circle({cx: 20, cy: 20, r: 20}));
|
29 |
|
30 | svg.append("rect")
|
31 | .attr("x", 0)
|
32 | .attr("y", 70)
|
33 | .attr("width", 40)
|
34 | .attr("height", 40);
|
35 |
|
36 | svg.append("path")
|
37 | .attr("transform", "translate(45, 0)")
|
38 | .attr("d", shape2path.rect({x: 0, y: 70, width: 40, height: 40}));
|
39 |
|
40 | svg.append("rect")
|
41 | .attr("x", 0)
|
42 | .attr("y", 120)
|
43 | .attr("width", 200)
|
44 | .attr("height", 200)
|
45 | .attr("rx", 20)
|
46 | .attr("ry", 10);
|
47 |
|
48 | svg.append("path")
|
49 | .attr("transform", "translate(220, 0)")
|
50 | .attr("d", shape2path.rect({x: 0, y: 120, width: 200, height: 200, rx: 20, ry: 10}));
|
51 |
|
52 | svg.append("rect")
|
53 | .attr("x", 0)
|
54 | .attr("y", 340)
|
55 | .attr("width", 100)
|
56 | .attr("height", 100)
|
57 | .attr("rx", 15);
|
58 |
|
59 | svg.append("path")
|
60 | .attr("transform", "translate(120, 0)")
|
61 | .attr("d", shape2path.rect({x: 0, y: 340, width: 100, height: 100, rx: 15}));
|
62 |
|
63 | svg.append("ellipse")
|
64 | .attr("cx", 150)
|
65 | .attr("cy", 25)
|
66 | .attr("rx", 50)
|
67 | .attr("ry", 25);
|
68 |
|
69 | svg.append("path")
|
70 | .attr("transform", "translate(0, 55)")
|
71 | .attr("d", shape2path.ellipse({cx: 150, cy: 25, rx: 50, ry: 25}));
|
72 |
|
73 | svg.append("line")
|
74 | .attr("x1", 220)
|
75 | .attr("x2", 300)
|
76 | .attr("y1", 100)
|
77 | .attr("y2", 00)
|
78 | .style("stroke", "black");
|
79 |
|
80 | svg.append("path")
|
81 | .attr("transform", "translate(0, 10)")
|
82 | .attr("d", shape2path.line({x1: 220, x2: 300, y1: 100, y2: 0}))
|
83 | .style("stroke", "black");
|
84 |
|
85 | svg.append("polygon")
|
86 | .attr("fill", "none")
|
87 | .attr("stroke", "black")
|
88 | .attr("points", "270,340 310,360 310,400 270,420 230,400 230,360");
|
89 |
|
90 | svg.append("path")
|
91 | .attr("fill", "none")
|
92 | .attr("stroke", "black")
|
93 | .attr("transform", "translate(100, 0)")
|
94 | .attr("d", shape2path.polygon({points: "270,340 310,360 310,400 270,420 230,400 230,360"}));
|
95 |
|
96 | svg.append("polyline")
|
97 | .attr("fill", "none")
|
98 | .attr("stroke", "black")
|
99 | .attr("points", "270,100 290,60 320,80 350,20");
|
100 |
|
101 | svg.append("path")
|
102 | .attr("transform", "translate(69, 0)")
|
103 | .attr("fill", "none")
|
104 | .attr("stroke", "black")
|
105 | .attr("d", shape2path.polyline({points: "270,100 290,60 320,80 350,20"}));
|
106 |
|
107 | </script>
|
108 | </body>
|
109 | </html> |
\ | No newline at end of file |