Simple JS Physics
Modeling physics-based animations in the browser is fairly trivial using JS and some simple arithmetic.
class Body {
pos: Vec;
vel: Vec;
acc: Vec;
apply(force: Vec) {
this.acc.add(force);
}
step() {
this.vel.add(this.acc);
this.pos.add(this.vel);
this.acc.div(0);
}
}
You could make this more interesting by attaching mass to the body, or applying angular velocity.
Check out my canvas lab for more examples.