๐ฅ Fire & Ice — Magic Hand Particle System ❄️ | Pure Python
Fire & Ice
Magic Hand Particle System
// Real-time · Hand Tracking · Pure Python · Zero Game Engine
๐ The Story
What happens when you bring your hands in front of a camera and suddenly the room fills with blazing fire particles and shimmering ice crystals? That's exactly what this project does — and it does it with pure Python, no game engine, no Unity, no Unreal Engine.
Built with MediaPipe's hand landmark detection and OpenCV rendering, this project tracks your hands in real-time and spawns 5,000 physics-driven particles around them. Your left hand summons fire. Your right hand conjures ice. Bring them close together and watch the fusion explosion light up your screen.
Point your index finger and you enter Air Drawing mode — trails of glowing light follow your fingertip and persist on screen. Close your fist and particles explode outward dramatically. This is computer vision magic, built by one person, from scratch.
✨ What Makes This Special
๐ ️ How It Works
๐ฎ Controls
GESTURE + KEYBOARD REFERENCE
| Left hand in frame | ๐ฅ Summons Fire particles — blazing upward spiral |
| Right hand in frame | ❄️ Conjures Ice particles — shimmering crystal field |
| Both hands close (<180px) | ⚡ Fusion mode — dual-element collision vortex |
| Point index finger | ✍️ Air-draw mode — glowing trails persist on canvas |
| Close fist | ๐ฅ Explode — particles blast radially outward |
| Open palm | ๐ Calm orbit mode — gentle spiral |
| Q | Quit the application |
| R | Reset all particles and clear canvas |
| S | Save screenshot to screenshots/ folder |
| F | Toggle fullscreen mode |
| B | Toggle 300-star ambient star field |
| 1 2 3 | Switch colour themes — live, no restart needed |
๐ Quick Start
๐ป Physics Engine (Core Snippet)
# Orbit force — spirals particle around hand nx = dx / best_d # Normal (radial) direction ny = dy / best_d tx = -ny # Tangent (orbit) direction ty = nx t_strength = ORBIT_FORCE * (1.0 - best_d / hand_radius_logic) fx += tx * t_strength * 9.0 fy += ty * t_strength * 9.0 # Shell force — maintains ideal orbit radius shell_err = IDEAL_ORBIT_R - best_d fx += nx * shell_err * REPEL_FORCE # Element drift — fire UP, ice SIDEWAYS if self.element == 'Fire': fy -= 0.6 # Fire rises against gravity elif self.element == 'Ice': fy += 0.3 # Ice drifts downward # Add organic noise for natural feel fx += random.gauss(0, NOISE_F)
๐ง Troubleshooting
pip install opencv-pythonpip install mediapipe==0.10.8 protobuf==3.20.3cv2.VideoCapture(0) to cv2.VideoCapture(1) in main.pyPARTICLE_COUNT in main.py from 5000 to 2000–3000๐จ๐ป Author
Open-source and free. If it impressed you, a ⭐ on GitHub means the world.
Comments
Post a Comment