Back to projects

Live demo

Crash Carts

Why it’s useful

I built and used this with my physics students as a small demo that makes momentum conservation visible instead of leaving it as an equation on a page.

What it does

  • Simulates a collision between two carts.
  • Lets visitors adjust cart masses, velocities, and collision type.
  • Animates the collision and shows the final state produced by the initial conditions.
  • Shows before-and-after momentum and kinetic-energy values so the model can be inspected.

Current status / Next steps

Current status

  • Live teaching demo at crashcarts.gavinnesom.com.
  • The current version supports adjustable cart masses, velocities, and collision type.
  • I have used this with physics students as a visual companion to the momentum equations.

Next steps

  • Tighten the explanatory copy around elastic and inelastic collisions.
  • Add clearer visual cues for momentum and kinetic energy.
  • Add coefficient of restitution.

Build / Deployment

Next.js · React · JavaScript · Canvas animation · Physics modeling

Crash Carts is a standalone teaching demo. Next.js builds the React page and supporting JavaScript/CSS assets, and Vercel publishes the site at crashcarts.gavinnesom.com.

Source

The teaching demo lives in its own app repo with the page, controls, physics code, and canvas view.

Build

Next.js builds the React page and supporting JavaScript/CSS assets for the published app.

Deploy

Vercel publishes the standalone demo at crashcarts.gavinnesom.com.

Architecture / How it works

Controls and state

Inputs hold the cart masses, velocities, and collision type so students can change the initial conditions.

Collision model

The model calculates the before-and-after momentum and kinetic energy values for comparing the collision state.

Canvas view

The canvas renders the two carts and the collision result so the calculation has a visible motion model beside it.

Design Principles

Visible physics

  • A simple physics scenario becomes clearer when the animation and calculations are visible together.
  • Before-and-after values make conservation laws easier to inspect.

Controls near the model

  • Changing mass, velocity, and collision type should immediately affect the result.
  • The controls should stay close enough to the animation that students can connect cause and effect.

Small teaching demo

  • Canvas can make a small teaching demo feel immediate without adding much machinery.
  • The goal is not a full physics engine; it is a focused classroom tool.

Links