Setup looks good — React 19 + Vite + Tailwind v4. I'll build a full physics playground on Matter.js with a custom neon canvas renderer, 10 mouse tools, and 10 demo scenes. Starting with the physics core utilities:
Core utilities created. Now the scene builders — 10 physics phenomena demos (Newton's cradle, wrecking ball, cloth, bridge, buoyancy tank, etc.):
Fixing the leftover unused helper in the bridge scene:
Now the heart of the app — world.ts: the Matter.js engine wrapper with custom neon renderer, particles, shockwaves, water buoyancy, screen shake, and all 10 mouse tools:
Fixing the two lint errors — unused variable and the Constraint.plugin typing:
Physics core complete. Now the UI components — toolbar, header, controls panel, scene bar, and hint pill:
Now the controls panel and scene bar:
Now the main App wiring everything together, with keyboard shortcuts:
Now the styling (Tailwind v4 theme, glassmorphism, neon range sliders) and the index.html with fonts and title:
Let's build to verify everything compiles:
Build succeeded. Let me review a few details — first check main.tsx, then fix a few refinements I spotted (paused mode shouldn't fade trails away, redundant bounds creation, and a ReactNode type import):
All fixed. Rebuilding to confirm everything's clean:
Build is clean. PHYSX LAB — a 2D physics playground — is ready to play with.
What you got
10 mouse tools (left rail, hotkeys 1–0):
- Grab — drag & fling any body with a spring tether
- Spawn — click to drop shapes, or hold-drag-release to throw them
- Slingshot — pull back from any body (or empty air) and release to launch it
- Explode — click to detonate, drag outward to charge a bigger shockwave (with screen shake + bass boom)
- Gravity Well / Repulsor — hold to bend gravity toward/away from your cursor
- Slice — drag a cut line clean through objects; they split into two real bodies (convex polygon clipping)
- Rope — drag point-to-point to weave ropes; ends tie to bodies or pin to the world
- Soft Body — drop squishy jelly blobs
- Eraser — vaporize matter into sparks
10 demo scenes (bottom bar): Sandbox, Ball Pit, Pyramid + ammo, Newton's Cradle (perfectly elastic pendulums), Wrecking Ball + brick tower, pinned Cloth curtain, soft-body stack, Dominoes, suspension Bridge, and a Water Tank with true density-based buoyancy — wood floats, steel sinks, splashes included.
Physics lab panel (right side): gravity Y/X sliders with Normal/Moon/Zero-G/Anti/Heavy presets, gusting wind, bounciness, friction, air drag, and time warp for slow-mo.
The juice: custom neon canvas renderer with motion trails, impact sparks scaled by collision force, expanding shockwave rings, screen shake, animated water surface with bubbles, and a tiny WebAudio synth for pops, swishes, splashes, and explosions (toggle with M). Space pauses, R resets, C clears, T toggles trails.
Try this: Newton's Cradle → gravity well to drag the chain sideways; Wrecking Ball → set time warp to 0.2 and explode the tower mid-collapse; Water Tank → crank gravity to Heavy and watch everything slam-submerge.
Files built: src/physics/palette.ts, src/physics/slice.ts, src/physics/audio.ts, src/physics/scenes.ts, src/physics/world.ts, src/components/Toolbar.tsx, src/components/Header.tsx, src/components/ControlsPanel.tsx, src/components/SceneBar.tsx, src/App.tsx, src/index.css, index.html