Release v3.2
π What's New
Add & Remove Points via NaN Positions (with fade in/out)
Screen.Recording.2026-07-08.at.14.22.48.mov
Removing a point used to mean shrinking the positions array β renumbering every later point and making the whole graph jump. Now set a point's position to NaN and it fades out in place; every other point keeps its index and spot. Giving the slot a real position fades it back in.
// remove point i β it fades out, everything else stays put
positions[i * 2] = NaN
positions[i * 2 + 1] = NaN
graph.setPointPositions(positions)- The fade is automatic β or pass per-point sizes/colors in the same update to shrink, fade, or recolor a point as it leaves. Hover picking keeps working while a bare removal fades.
- Links follow their points β they fade out with a removed endpoint and stop being hoverable; drop them whenever you compact.
- Absent points are really gone β excluded from all forces (safe with the simulation on or off), from hover, selection, sampling, and zoom/
fitView. - Your arrays stay yours β size/color arrays are read as-is and never modified (
NaNchannels resolve at render time), and read-backs are honest: absent points come back asNaN(getTrackedPointPositionsMapomits them),getPointColors/getPointSizesreturn as-rendered snapshots. - Opt-in and non-breaking β shrinking the array still works exactly as before. cosmos.gl does not auto-compact the gaps; reuse freed slots or compact when convenient.
Per-render transition duration: render(simulationAlpha?, transitionDuration?)
render() takes an optional duration (ms) for the transition it starts β this call only. 0 snaps, undefined uses config.transitionDuration. Made for compaction: drop the tombstones, renumber, and snap so nothing visibly moves.
graph.setPointPositions(compactedPositions)
graph.render(undefined, 0) // snap this update onlyA transition already playing keeps its own duration β changing transitionDuration via config no longer affects it. To end one immediately, apply an update with render(undefined, 0).