-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathindex.html
58 lines (54 loc) · 2.84 KB
/
index.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
<head>
<style> body { margin: 0; } </style>
<script src="//unpkg.com/3d-force-graph-vr"></script>
<!--<script src="../../dist/3d-force-graph-vr.js"></script>-->
</head>
<body>
<div id="3d-graph"></div>
<script>
const gData = {
nodes: [...Array(14).keys()].map(i => ({ id: i })),
links: [
{ source: 0, target: 1, curvature: 0, rotation: 0 },
{ source: 0, target: 1, curvature: 0.8, rotation: 0 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 1 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 2 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 3 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 4 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 5 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 7 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 8 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 9 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 10 / 6 },
{ source: 0, target: 1, curvature: 0.8, rotation: Math.PI * 11 / 6 },
{ source: 2, target: 3, curvature: 0.4, rotation: 0 },
{ source: 3, target: 2, curvature: 0.4, rotation: Math.PI / 2 },
{ source: 2, target: 3, curvature: 0.4, rotation: Math.PI },
{ source: 3, target: 2, curvature: 0.4, rotation: -Math.PI / 2 },
{ source: 4, target: 4, curvature: 0.3, rotation: 0 },
{ source: 4, target: 4, curvature: 0.3, rotation: Math.PI * 2 / 3 },
{ source: 4, target: 4, curvature: 0.3, rotation: Math.PI * 4 / 3 },
{ source: 5, target: 6, curvature: 0, rotation: 0 },
{ source: 5, target: 5, curvature: 0.5, rotation: 0 },
{ source: 6, target: 6, curvature: -0.5, rotation: 0 },
{ source: 7, target: 8, curvature: 0.2, rotation: 0 },
{ source: 8, target: 9, curvature: 0.5, rotation: 0 },
{ source: 9, target: 10, curvature: 0.7, rotation: 0 },
{ source: 10, target: 11, curvature: 1, rotation: 0 },
{ source: 11, target: 12, curvature: 2, rotation: 0 },
{ source: 12, target: 7, curvature: 4, rotation: 0 },
{ source: 13, target: 13, curvature: 0.1, rotation: 0 },
{ source: 13, target: 13, curvature: 0.2, rotation: 0 },
{ source: 13, target: 13, curvature: 0.5, rotation: 0 },
{ source: 13, target: 13, curvature: 0.7, rotation: 0 },
{ source: 13, target: 13, curvature: 1, rotation: 0 }
]
};
const Graph = new ForceGraphVR(document.getElementById('3d-graph'))
.linkCurvature('curvature')
.linkCurveRotation('rotation')
.linkDirectionalParticles(2)
.graphData(gData);
</script>
</body>