flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
57
VISUALIZACION/node_modules/3d-force-graph/example/manipulate-link-force/index.html
generated
vendored
Executable file
57
VISUALIZACION/node_modules/3d-force-graph/example/manipulate-link-force/index.html
generated
vendored
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
<head>
|
||||
<style> body { margin: 0; } </style>
|
||||
|
||||
<script src="//unpkg.com/dat.gui"></script>
|
||||
<script src="//unpkg.com/3d-force-graph"></script>
|
||||
<!-- <script src="../../dist/3d-force-graph.js"></script> -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="3d-graph"></div>
|
||||
|
||||
<script>
|
||||
// Create Random tree
|
||||
const N = 20;
|
||||
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)),
|
||||
color: id % 2
|
||||
}))
|
||||
};
|
||||
|
||||
const graph = ForceGraph3D()
|
||||
(document.getElementById('3d-graph'))
|
||||
.nodeLabel(node => node.id)
|
||||
.linkColor(link => link.color ? 'red' : 'green' )
|
||||
.linkOpacity(1)
|
||||
.graphData(gData);
|
||||
|
||||
const linkForce = graph
|
||||
.d3Force('link')
|
||||
.distance(link => link.color ? settings.redDistance : settings.greenDistance);
|
||||
|
||||
//Define GUI
|
||||
const Settings = function() {
|
||||
this.redDistance = 20;
|
||||
this.greenDistance = 20;
|
||||
};
|
||||
|
||||
const settings = new Settings();
|
||||
const gui = new dat.GUI();
|
||||
|
||||
const controllerOne = gui.add(settings, 'redDistance', 0, 100);
|
||||
const controllerTwo = gui.add(settings, 'greenDistance', 0, 100);
|
||||
|
||||
controllerOne.onChange(updateLinkDistance);
|
||||
controllerTwo.onChange(updateLinkDistance);
|
||||
|
||||
function updateLinkDistance() {
|
||||
linkForce.distance(link => link.color ? settings.redDistance : settings.greenDistance);
|
||||
graph.numDimensions(3); // Re-heat simulation
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue