-
Notifications
You must be signed in to change notification settings - Fork 294
/
Copy pathindex.html
73 lines (67 loc) · 3.28 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<head>
<style> body { margin: 0; } </style>
<script type="importmap">{ "imports": {
"react": "https://esm.sh/react",
"react-dom": "https://esm.sh/react-dom/client"
}}</script>
<script type="module">
import * as React from 'react';
window.React = React;
</script>
<script src="//unpkg.com/react-force-graph-vr" defer></script>
<!--<script src="../../src/packages/react-force-graph-vr/dist/react-force-graph-vr.js" defer></script>-->
</head>
<body>
<div id="graph"></div>
<script src="//unpkg.com/@babel/standalone"></script>
<script type="text/jsx" data-type="module">
import { createRoot } from 'react-dom';
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 }
]
};
createRoot(document.getElementById('graph')).render(
<ForceGraphVR
graphData={gData}
linkCurvature="curvature"
linkCurveRotation="rotation"
linkDirectionalParticles={2}
/>
);
</script>
</body>