A 2D procedural animation engine built in Rust using Bevy. No physics library — every system is written from math up.
Nodes move via Verlet integration, stay connected through an iterative constraint solver, walk on FABRIK-driven limbs, navigate using lookahead steering, and get wrapped in a Catmull-Rom spline skin that deforms live with the simulation.
Play around with the editor, load an example, and watch it go.
You can access the project from the attached github pages link: Sway | Procedural Animation Engine
OR run it locally:
git clone https://github.com/Mo2Hefny/Sway.git
cd Sway
cargo run --releasegit clone https://github.com/Mo2Hefny/Sway.git
cd Sway
trunk serveThe math and architecture behind each system is documented in /docs:
| Doc | What's In It |
|---|---|
| Physics & Movement | Verlet integration, air damping, constant acceleration, anchor handling, distance & angle constraints |
| Collision System | Boundary collision, node–node push-apart, spatial hash grid, group awareness, wander steering |
| Limbs & Inverse Kinematics | FABRIK solver, bend control, stepping system, ideal target computation |
| Visuals & Rendering | Node visuals, spline skin, miter outlines, limb mesh, Z-draw order |
Evaluating different visual layers — from the underlying skeleton and FABRIK limbs to the spline-smoothed skin.
showcase.mp4
Handling dozens of independent procedural creatures using a spatial hash grid for
swarm.mp4
Simulating different creature types (Lizards and Snakes) in the same arena, each with different constraint and limb configurations.
mix.mp4
src/
core/ — physics engine (nodes, solver, collision, FABRIK)
editor/ — rendering, mesh generation, visuals
ui/ — inspector, toolbar, panels
docs/ — system documentation
examples/ — prebuilt scenes
