-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPentagon.html
81 lines (63 loc) · 1.37 KB
/
Pentagon.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
78
79
80
81
<head>
<script src="https://d3js.org/d3.v4.js"></script>
</head>
<body>
<svg width='800' height='800' style="background-color:gold;">
</svg>
<script>
var c1 = Math.cos((2*Math.PI)/5)*100
var s1 = Math.sin((2*Math.PI)/5)*100
var c2 = Math.cos(Math.PI/5)*100
var s2 = Math.sin((4*Math.PI)/5)*100
d3.select('svg')
.append('circle')
.attr('cx',400)
.attr('cy',400)
.attr('r',10)
.attr('stroke-width',3)
.attr('fill','red');
d3.select('svg')
.append('circle')
.attr('cx',400)
.attr('cy',400)
.attr('r',100)
.attr('stroke-width',3)
.attr('stroke','black')
.attr('fill','none');
d3.select('svg')
.append('circle')
.attr('cx',400+100)
.attr('cy',400)
.attr('r',10)
.attr('stroke-width',3)
.attr('fill','purple');
d3.select('svg')
.append('circle')
.attr('cx',400+c1)
.attr('cy',400+s1)
.attr('r',10)
.attr('stroke-width',3)
.attr('fill','orange');
d3.select('svg')
.append('circle')
.attr('cx',400+c1)
.attr('cy',400-s1)
.attr('r',10)
.attr('stroke-width',3)
.attr('fill','blue');
d3.select('svg')
.append('circle')
.attr('cx',400-c2)
.attr('cy',400+s2)
.attr('r',10)
.attr('stroke-width',3)
.attr('fill','blue');
d3.select('svg')
.append('circle')
.attr('cx',400-c2)
.attr('cy',400-s2)
.attr('r',10)
.attr('stroke-width',3)
.attr('fill','blue');
</script>
</body>