A full Go port of cosmos.gl 2.6.3, the WebGL force-directed layout algorithm and rendering engine behind Cosmograph and, in its 1.x form, the Skywire network visualizer. Every computation and every draw happens on the GPU in vertex and fragment shaders, carried over verbatim from the original, which is what makes real-time layout of very large network graphs possible.
The port drives the shaders through syscall/js with a raw WebGL command layer replacing regl, and reimplements the d3-zoom and d3-drag interaction behaviours including d3's smooth van Wijk–Nuij zoom transitions. It compiles with both the standard Go toolchain and TinyGo.
Ported features: GPU many-body repulsion in two variants, springs, gravity, centering, mouse repulsion and clustering forces; pan and zoom; point dragging and pinning; nine point shapes; image-atlas point sprites; hover and focus rings; GPU picking for points and links; link arrows and curved links; rectangle and polygon selection with greyout; position tracking, viewport sampling, fit-view animation and deterministic layouts from a random seed.
Source code: github.com/0magnet/cosmos-go. More Go and WebAssembly projects: magnetosphere.net/software.