Skip to content

๐Ÿงช An interactive particle physics sandbox that simulates various elements and their interactions. Features sand, water, fire, and more with realistic behaviors. Updates in real-time with smooth animations.

Notifications You must be signed in to change notification settings

jonasfabian/sandsim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ๏ธ SandSim

An interactive particle physics sandbox simulator built with JavaScript.

Sand Animation

โœจ Features

  • Multiple Elements ๐Ÿงช: Experiment with various materials including:

    • ๐Ÿœ๏ธ Sand: Falls and creates realistic piles
    • ๐Ÿ’ง Water: Flows and spreads horizontally
    • ๐Ÿ›ข๏ธ Oil: Floats on water and is flammable
    • ๐Ÿ”ฅ Fire: Rises and ignites flammable materials
    • ๐Ÿ’ฅ Gunpowder: Explodes when ignited
    • ๐Ÿงช Acid: Dissolves other materials
    • ๐Ÿงฑ Concrete: Creates solid barriers
    • ๐ŸŒ‹ Lava: Flows slowly and solidifies into stone
    • ๐ŸŒฑ Seeds: Grow into plants over time
    • โ„๏ธ Ice: Melts when heated
  • Interactive Controls ๐ŸŽฎ:

    • Adjustable brush size
    • Pause/resume simulation
    • Clear canvas
    • Mouse wheel support for brush sizing
  • Dynamic Physics โš™๏ธ:

    • Gravity and fluid dynamics
    • Material interactions (fire ignites oil, acid erodes concrete, etc.)
    • Temperature effects (ice melting, lava solidifying)
  • Responsive Design ๐Ÿ“ฑ:

    • Automatically adapts to different screen sizes
    • Modern UI with glass-morphism effects
    • Performance metrics display (FPS counter)

๐Ÿš€ How to Use

  1. Select an element from the sidebar
  2. Click and drag on the canvas to place elements
  3. Use the mouse wheel to adjust brush size
  4. Experiment with different combinations:
    • ๐Ÿ’ง+๐Ÿ”ฅ Pour water onto fire
    • ๐Ÿงช+๐Ÿงฑ Drop acid onto concrete
    • ๐ŸŒฑ+๐Ÿ’ง Place seeds in water
    • ๐Ÿ”ฅ+๐Ÿ›ข๏ธ Ignite oil or gunpowder with fire

๐Ÿ”ง Technical Details

SandSim uses a cellular automaton approach to simulate particle physics:

  • Each cell in the grid can contain one particle
  • Particles have properties like velocity, temperature, and reactivity
  • The simulation updates in discrete steps, with each particle following simple rules
  • Rendering is optimized for smooth performance on modern browsers

๐Ÿ’ป Development

This project is built with vanilla JavaScript and HTML Canvas for rendering. The structure follows a modular approach with:

  • Core systems (Grid, Canvas, SimulationLoop)
  • Particle types with specific behaviors
  • Tool interfaces for user interaction

๐Ÿ‘ Credits

Inspired by Jason's Falling Sand and other cellular automaton simulations.

๐Ÿ“„ License

MIT

About

๐Ÿงช An interactive particle physics sandbox that simulates various elements and their interactions. Features sand, water, fire, and more with realistic behaviors. Updates in real-time with smooth animations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published