Skip to main content
100%

Force with Springy Links

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 5, 2018
Created on Sep 5, 2018

A network of one hundred nodes linked in a branching tree structure renders with wavy, spring-like curved edges instead of straight lines. Dragging nodes with the mouse repositions them while the force simulation dynamically updates the paths. Using d3.forceSimulation for layout and d3.drag for interaction, the `wave` function computes each link path by sampling sine-wave offsets along the straight line between connected nodes, with the wave frequency scaled to the link’s length. Node radii and colors are randomly assigned from a categorical scale, and the d3-marcon library provides the full viewport canvas.

AI-generated description

Forked from Pratap Vardhan's block.

Make link paths wavy for randomly-generated network.

wave function creates a wavy-like path between source and target link, using coordinate transforamtions.

I just updated the wave function so that the step variable is dependent upon the distance between nodes, so the link looks like a spring.

forked from <a href='http://bl.ocks.org/HarryStevens/'>HarryStevens</a>'s block: <a href='http://bl.ocks.org/HarryStevens/f8f83172e23f3044df07afc2b5bc212b'>Force with Springy Links</a>

gpl-3.0 Licensed

Similar vizzes