-
Notifications
You must be signed in to change notification settings - Fork 287
/
index-three.html
43 lines (37 loc) · 1.57 KB
/
index-three.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
<head>
<style> body { margin: 0; } </style>
<script src="//unpkg.com/react/umd/react.production.min.js"></script>
<script src="//unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
<script src="//unpkg.com/@babel/standalone"></script>
<script src="//unpkg.com/react-force-graph-vr"></script>
<!--<script src="../../src/packages/react-force-graph-vr/dist/react-force-graph-vr.js"></script>-->
<script src="../datasets/random-data.js"></script>
</head>
<body>
<div id="graph"></div>
<script type="text/jsx" data-type="module">
import * as THREE from '//unpkg.com/three/build/three.module.js';
ReactDOM.render(
<ForceGraphVR
graphData={genRandomTree(100)}
nodeThreeObject={({ id }) => new THREE.Mesh(
[
new THREE.BoxGeometry(Math.random() * 20, Math.random() * 20, Math.random() * 20),
new THREE.ConeGeometry(Math.random() * 10, Math.random() * 20),
new THREE.CylinderGeometry(Math.random() * 10, Math.random() * 10, Math.random() * 20),
new THREE.DodecahedronGeometry(Math.random() * 10),
new THREE.SphereGeometry(Math.random() * 10),
new THREE.TorusGeometry(Math.random() * 10, Math.random() * 2),
new THREE.TorusKnotGeometry(Math.random() * 10, Math.random() * 2)
][id%7],
new THREE.MeshLambertMaterial({
color: Math.round(Math.random() * Math.pow(2, 24)),
transparent: true,
opacity: 0.75
})
)}
/>,
document.getElementById('graph')
);
</script>
</body>