Kanishk Sachdev

Software Engineer and Student

Sand Simulation

A physics-based sand simulation built with HTML5 Canvas and React. This implements a cellular automaton where each sand particle follows gravity and collision physics.

How it Works

Each sand grain is represented in a 2D grid with position and velocity. The simulation uses Verlet integration for physics:
Gravity: Constant downward acceleration of 0.1 units
Collision detection: Particles check for empty spaces below and to the sides
Flow behavior: When blocked vertically, sand flows randomly left or right
Visual variety: Each particle gets a unique HSL color that shifts over time

Interaction: Drag your pointer over the canvas to drop sand particles. They'll fall and accumulate under simulated gravity, creating natural pile formations.

Feel free to contact me at kanishksachdev@gmail.com