我创建了带有3D力图(https://github.com/vasturiano/3d-force-graph)的3D图表。我想使用ar.js将该图表转换为基于增强现实网络的应用程序。 3d-force-graph正在使用three.js创建一个<canvas>
元素。我可以将<canvas>
与ar.js混合吗?
在ar.js的一些示例中,我不得不使用A-Frame(aframe.js)创建具有某些对象的场景,但是我的场景已经创建。
<canvas>
一起使用,而根本不必使用aframe.js?<canvas>
作为场景?<canvas>
中的3d对象作为对象导出到aframe.js场景中?我已经使用3D力图创建了一个代码段。
谢谢
// Random tree
const N = 300;
const gData = {
nodes: [...Array(N).keys()].map(i => ({ id: i })),
links: [...Array(N).keys()]
.filter(id => id)
.map(id => ({
source: id,
target: Math.round(Math.random() * (id-1))
}))
};
const Graph = ForceGraph3D()
(document.getElementById('3d-graph'))
.graphData(gData);
<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>
</body>