Public
Edited
Jul 14, 2020
1 fork
15 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
simulation = d3
.forceSimulation()
.alphaDecay(0)
.velocityDecay(0)
.force('collision', d3.forceCollide(d => d.r))
.force('walls', wallForce);
Insert cell
{ simulation.nodes(nodes) }
Insert cell
wallForce = d3.forceLimit()
.radius(node => node.r)
.x0(0)
.x1(width)
.y0(0)
.y1(height)
Insert cell
wallForce
.cushionWidth(cushionWidth)
.cushionStrength(cushionStrength)
Insert cell
{
!!reEnergize;
const maxVelocity = 10;
const boostFactor = 3;
nodes.forEach(node => {
node.vx = Math.min(node.vx * boostFactor, maxVelocity);
node.vy = Math.min(node.vy * boostFactor, maxVelocity);
});
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more