1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <head>
- <style> body { margin: 0; } </style>
- <script src="//unpkg.com/3d-force-graph"></script>
- <!--<script src="../../dist/3d-force-graph.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 = ForceGraph3D()
- (document.getElementById('3d-graph'))
- .linkCurvature('curvature')
- .linkCurveRotation('rotation')
- .linkDirectionalParticles(2)
- .graphData(gData);
- </script>
- </body>
|