A network held together by Hooke's law
A spring-mass system is exactly what it sounds like: point masses connected by springs, each spring pulling or pushing according to Hooke's law, F = −k·x, where x is how far the spring is stretched or compressed from its rest length and k is its stiffness. Wire enough of these together in a chain, grid, circle or star topology and you get a network capable of surprisingly rich collective behaviour — waves travelling along a chain, a grid that ripples like a drumhead, a star that oscillates around its rest shape — all from the same one-dimensional force law applied to every edge.
for each spring (mass A, mass B, restLength, k):
delta = posB - posA
stretch = length(delta) - restLength
force = k * stretch * normalize(delta)
applyForce(A, force)
applyForce(B, -force) // equal and opposite, Newton's third law
add damping proportional to relative velocity along the spring
Why Verlet integration, not the naive approach
Turning those forces into motion means integrating Newton's second law, and the naive choice — explicit Euler, moving each mass with its old velocity — tends to add energy every step and makes a spring network blow up into wild, growing oscillations, especially with stiff springs or a coarse time step. This simulation instead uses Verlet integration: rather than storing a velocity explicitly, each mass remembers its previous position, and the next position is extrapolated directly from the last two:
x_next = 2·x_current − x_previous + a·h² (a = force / mass) // velocity is implied, never stored directly: v ≈ (x_current − x_previous) / h
This form, sometimes called position Verlet or Störmer-Verlet, is a favourite for spring and cloth solvers for a very practical reason: constraints and dragging are simple to apply. Grab a mass with the mouse and you just set its position directly — there is no separate velocity value to reconcile, because the velocity is always recomputed automatically from the difference between two stored positions on the next step. It is also symplectic, meaning it conserves a shadow energy that stays bounded over long runs instead of drifting away, which is exactly what keeps a spring network settling into a believable, non-exploding equilibrium rather than gaining energy out of nowhere.
Topology decides what a network can do
A chain topology — masses connected end to end in a single line — is the simplest setting to see wave propagation: pluck one end and a disturbance visibly travels down the chain at a speed set by the spring stiffness and the mass of each node, the discrete analogue of a wave on a string. A grid topology extends the same idea into two dimensions, letting a poke in the middle ripple outward in circles, similar to a drumhead or a trampoline. A circle closes the chain into a loop, so a wave sent around it can constructively interfere with itself. A star — many outer masses connected to one shared centre, and often to each other — behaves more like a single flexible object that wobbles and settles as a whole, useful for soft-body-style shapes.
Stiffness (k) and damping are the two knobs that most change how a network feels. High stiffness with low damping produces fast, springy, almost rigid-looking motion where waves travel quickly and barely lose energy; low stiffness with high damping produces the slow, gooey settling of something closer to jelly. Because Verlet integration is unconditionally friendlier to stiff springs than explicit Euler, this simulation can push stiffness fairly high and still stay numerically stable at a real-time frame rate.
Frequently asked questions
Why does the simulation use Verlet integration instead of just applying forces directly?
Directly stepping position and velocity forward with the most obvious method (explicit Euler) tends to add energy every frame, which makes a spring network's oscillations grow instead of settling — especially with stiff springs. Verlet integration is far more stable for exactly this kind of system and makes dragging a mass trivial, since you only ever set a position, never a separate velocity.
Why does a wave travel down the chain instead of everything moving at once?
Each mass only feels the springs directly attached to it, so a disturbance at one end has to propagate mass-by-mass along the chain, taking a finite amount of time per link — exactly the discrete version of how a real wave travels through a continuous string or rope.
What's the difference between a chain, grid, circle and star topology here?
They differ only in which masses are connected by springs: a chain is a single line good for seeing linear wave propagation, a grid extends that into two dimensions like a drumhead, a circle is a closed loop where waves can interfere with themselves, and a star connects many outer masses to a shared centre, producing a single wobbling soft-body-like shape.
Try it live
Everything above runs in your browser — open Spring-Mass Network and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Spring-Mass Network simulation