What is Particle Simulator?
Particle Simulator is a real-time particle simulation and visualization engine that brings physics to life in your browser. Built with React, Three.js, and TypeScript, it provides an interactive 3D environment where you can create particles, define forces, and watch complex physics simulations unfold in real-time.Originally created as a tool for academic self-defense against challenging Physics 2 exams, this simulator has evolved into a powerful educational and visualization platform.
Key Features
Dual Physics Modes
Switch between Dynamic mode (force-based) and Kinematic mode (position functions) to simulate different types of motion.
Real-Time 3D Visualization
Powered by Three.js with interactive camera controls, particle trails, force vectors, and customizable views.
Advanced Formula Support
Use mathematical expressions with full JavaScript Math library support including trigonometric, hyperbolic, and logarithmic functions.
Performance Optimized
Handle 100+ particles with stable FPS through function caching and direct mesh manipulation that bypasses React’s render cycle.
Use Cases
Educational Physics Visualization
- Visualize complex force interactions and particle dynamics
- Understand harmonic oscillators, gravitational systems, and damped motion
- Experiment with different initial conditions and observe outcomes
Scientific Simulations
- Model N-body problems with custom force laws
- Simulate orbital mechanics and gravitational attractions
- Test inverse-square laws and other physical principles
Creative Exploration
- Create mesmerizing patterns with Lissajous curves and resonance
- Design pulsing vortices and hyperbolic damping effects
- Build custom particle systems with event-driven behaviors
Architecture Overview
Particle Simulator is built on a modern web stack:Project Structure
The codebase is organized into logical modules:Technical Highlights
Function Caching System
Mathematical expressions are compiled once and cached to avoid constant re-parsing:Direct Mesh Manipulation
Particle positions are updated directly on Three.js mesh references, bypassing React’s render cycle for smooth 60 FPS performance even with 100+ particles.Next Steps
Quick Start
Get your first simulation running in minutes
Installation
Set up the development environment locally
Configuration
Learn about particle properties and physics settings
Examples
Explore pre-built simulations and patterns