Skip to content

Mo2Hefny/Sway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sway Logo

Sway: A 2D Procedural Animation Engine

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.

Running

You can access the project from the attached github pages link: Sway | Procedural Animation Engine

OR run it locally:

Desktop

git clone https://github.com/Mo2Hefny/Sway.git
cd Sway
cargo run --release

Web

git clone https://github.com/Mo2Hefny/Sway.git
cd Sway
trunk serve

Documentation

The 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

Examples

1. Layers & Construction

Evaluating different visual layers — from the underlying skeleton and FABRIK limbs to the spline-smoothed skin.

showcase.mp4

2. The Swarm

Handling dozens of independent procedural creatures using a spatial hash grid for $O(n)$ collision broadphase and lookahead steering for proactive avoidance.

swarm.mp4

3. Mixed Simulation

Simulating different creature types (Lizards and Snakes) in the same arena, each with different constraint and limb configurations.

mix.mp4

Project Layout

src/
  core/      — physics engine (nodes, solver, collision, FABRIK)
  editor/    — rendering, mesh generation, visuals
  ui/        — inspector, toolbar, panels
docs/        — system documentation
examples/    — prebuilt scenes

About

A 2D procedural animation engine built in Rust using Bevy. No physics library — every system is written from math up.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors