Move example JS files

This commit is contained in:
Pitchaya Boonsarngsuk
2018-03-13 01:07:40 +00:00
parent f8caf36d62
commit 6df7e225ba
6 changed files with 5 additions and 5 deletions

View File

@@ -0,0 +1,48 @@
/**
* Initialize the hybrid layout algorithm and start simulation.
*/
function startHybridSimulation() {
console.log("startHybridSimulation");
springForce = false;
d3.selectAll(".nodes").remove();
manualStop = false;
simulation.stop();
p1 = performance.now();
function distance (s, t) {
return distanceFunction(s, t, props, norm);
}
let forceSample = d3.forceNeighbourSampling()
.neighbourSize(NEIGHBOUR_SIZE)
.sampleSize(SAMPLE_SIZE)
.stableVelocity(0)
.distance(distance)
let forceFull = d3.forceNeighbourSampling()
.neighbourSize(FULL_NEIGHBOUR_SIZE)
.sampleSize(FULL_SAMPLE_SIZE)
.distance(distance)
let hybridSimulation = d3.hybridSimulation(simulation, forceSample, forceFull)
.sampleIterations(ITERATIONS)
.fullIterations(FULL_ITERATIONS)
.numPivots(PIVOTS ? NUM_PIVOTS:-1)
.interpFindTuneIts(INTERP_ENDING_ITS)
.interpDistanceFn(distance)
.on("sampleTick", ticked)
.on("fullTick", ticked)
.on("startInterp", startedFull)
.on("end", ended);
let sample = hybridSimulation.subSet();
addNodesToDOM(sample);
hybridSimulation.restart();
function startedFull() {
console.log("startedFull");
d3.selectAll(".nodes").remove();
addNodesToDOM(nodes);
}
}