{
const Graph = ForceGraph3D()
(htmlElement)
.width(width)
.height(.75 * width)
.linkColor(link => link.type ? 'red' : 'green' )
.linkWidth(link => link.type ? 0 : 1)
.linkOpacity(1)
.nodeThreeObject(({ img }) => {
const obj = new THREE.Mesh(
new THREE.SphereGeometry(10),
new THREE.MeshBasicMaterial({ depthWrite: false, transparent: true, opacity: 0.1 })
);
const imgTexture = new THREE.TextureLoader()
.load(`https://gchapyzh.github.io/providence/assets/${img}.png`);
const material = new THREE.SpriteMaterial({ map: imgTexture });
const sprite = new THREE.Sprite(material);
sprite.scale.set(10, 10, 1);
obj.add(sprite);
return obj;
})
.graphData(gData)
.linkCurvature('curvature')
.d3Force('link').distance(link => link.type ? 100 : 50);
return Graph
}