2D truss analysis in your browser. Sketch a truss, drop supports and loads on it, and get member forces, reactions, and an exaggerated deformed shape — live, as you edit. No install, no server, no data leaving your machine: it's one HTML page and two scripts.
- Interactive editor — click to place joints (0.5 m snap grid), connect them with members, cycle support types (pin / roller / horizontal roller), and apply point loads at any joint.
- Live solving — re-solves on every edit using the direct stiffness method. Red = tension, blue = compression, line thickness scales with force magnitude.
- Full results — member force table (kN, T/C flags), support reactions, max deflection, and a static determinacy check (
m + r − 2n). - Mechanism detection — if your truss is unstable, the singular stiffness matrix is caught and reported instead of exploding into NaNs.
- Deformed shape — dashed overlay of the displaced geometry, auto-exaggerated to be visible.
- Presets — Warren, Pratt, and cantilever trusses to start from.
Each member is a pin-jointed axial bar. Per member, the local stiffness k = EA/L is rotated into global coordinates and assembled into the global stiffness matrix K. Constrained degrees of freedom (supports) are removed, and the reduced system K·u = F is solved by Gaussian elimination with partial pivoting. Member forces come from the axial elongation, reactions from back-substituting into the full system.
Units are chosen so nothing needs converting: coordinates in m, loads in kN, E in GPa, A in mm² — since E [GPa] × A [mm²] = EA [kN], forces fall out in kN and displacements in m.
Member forces in a statically determinate truss are independent of E and A (only deflections change) — the material panel exists so the deflection numbers mean something.
No build step, no dependencies:
git clone https://github.com/savage20021/trusslab
cd trusslab
python -m http.server 8000Then open http://localhost:8000 — or just double-click index.html.
- 2D pin-jointed trusses only — no beams, no moment connections, no distributed loads (resolve them to joint loads, like you would by hand).
- One E and A shared by all members.
- Linear elastic, small displacements. No buckling check — a slender member in compression is your problem to notice.
MIT — see LICENSE.
Built AI-assisted (Claude) — my direction, AI-assisted code.
