A browser-based retro-pixel themed sandbox where users can drag & drop circuit components onto a grid and see them "come alive" with pixel animations.ons.
- Breadboard-style grid background with retro 8-bit pixel aesthetic
- Drag & drop componentsents: wires, batteries, resistors, LEDs, switches, push buttons, buzzer, and logic gates (AND, OR, NOT, XOR, NAND, NOR)
- Real-time circuit simulation:
- Current flows from power β wire β component
- LEDs light up when powered with glow effects
- Logic gates calculate outputs instantly
- Switches can be toggled to control flow
- Push buttons provide momentary connections
- Buzzer produces audio when powered
- Pixel-style animations: sparks moving along wires, LED glow effects
- Retro 8-bit audio system: Sound effects for interactions and feedback
- Save/Load circuits with JSON format using localStorage
- Export/Import JSON for sharing circuits
- Pre-built starter circuits (blinking LED, basic AND gate)
- Audio controls: Volume adjustment and mute toggle
- Undo/Redo system: Full action history with 50-action memory
- Component rotation: Right-click context menu to rotate components
- Fully client-side - runs entirely in browser (no backend required)
- Static hosting compatible - perfect for GitHub Pages
- Lightweight - no external dependencies, pure vanilla JavaScript
- Responsive design - works on desktop and mobile browsers
- Pixel-perfect rendering with HTML5 Canvas
- Web Audio API integration - retro 8-bit sound effects system
- Advanced undo/redo - 50-action history with state management
- Component rotation system - context menus and keyboard shortcuts
- Drag components from the left toolbar onto the grid
- Click switches to toggle them on/off
- Hold push buttons to create momentary connections
- Right-click components to delete or rotate them
- Use Ctrl+Z/Y for undo/redo actions
- Watch the magic as LEDs light up, buzzers sound, and current flows through wires!
- Zoom controls: Use +/- buttons or keyboard shortcuts to zoom in/out
- Pan controls: Use arrow buttons to navigate around large circuits
- Center view: Click the home button to reset view position
- Audio controls: Adjust volume or mute sound effects
Delete/Backspace: Delete selected componentEscape: Deselect componentR: Rotate selected componentTab: Select next componentEnter/Space: Toggle switch (when switch is selected)Ctrl+S: Save circuitCtrl+O: Load circuitCtrl+C: Clear circuitCtrl+E: Export circuit to JSON fileCtrl+I: Import circuit from JSON fileCtrl+Z: Undo last actionCtrl+Shift+ZorCtrl+Y: Redo last undone actionCtrl+M: Toggle audio on/offCtrl+H: Show help dialogCtrl+G: Toggle grid visibilityCtrl++: Zoom inCtrl+-: Zoom outCtrl+0: Reset zoom
| Component | Description | Behavior |
|---|---|---|
| Battery | Power source (5V) | Always powered, provides current to connected components |
| LED | Light-emitting diode | Lights up and glows when powered |
| Resistor | Current limiter | Conducts electricity (simplified model) |
| Switch | On/off control | Click to toggle open/closed state |
| Push Button | Momentary switch | Conducts only while pressed (mouse down) |
| Wire | Conductor | Carries current between components with spark animation |
| Buzzer | Audio output | Produces sound when powered |
| AND Gate | Logic gate | Output HIGH only when both inputs are HIGH |
| OR Gate | Logic gate | Output HIGH when at least one input is HIGH |
| NOT Gate | Logic inverter | Output opposite of input (HIGHβLOW, LOWβHIGH) |
| XOR Gate | Exclusive OR gate | Output HIGH when inputs are different |
| NAND Gate | NOT-AND gate | Output LOW only when both inputs are HIGH |
| NOR Gate | NOT-OR gate | Output LOW when at least one input is HIGH |
CircuPlayCOPILOT/
βββ index.html # Main HTML page
βββ css/
β βββ style.css # Main retro-pixel styling
β βββ components.css # Component-specific styles
βββ js/
β βββ main.js # Main application logic
β βββ grid.js # Grid system for component placement
β βββ components.js # Component classes and factory
β βββ simulation.js # Circuit simulation engine
β βββ ui.js # UI controls and interactions
β βββ storage.js # Save/load functionality
β βββ audio.js # Audio system and sound effects
βββ README.md # This file
# This file
Circuits are saved as JSON with the following structure:
{
"name": "My Circuit",
"description": "Circuit description",
"data": {
"gridSize": 20,
"components": [
{
"type": "battery",
"x": 0,
"y": 0,
"properties": {}
}
]
},
"timestamp": 1640995200000,
"version": "1.0"
}}- Grid System: Manages component placement on a 2D grid
- Component System: Object-oriented component classes with inheritance
- Simulation Engine: Handles power flow and logic calculations
- UI Manager: Handles all user interactions and rendering
- Storage Manager: Manages save/load operations and localStorage
- Audio System: Web Audio API-based retro sound effects
- 60 FPS rendering with requestAnimationFrame
- Efficient grid-based collision detection
- Minimal DOM manipulation (canvas-based rendering)
- Lazy evaluation of circuit simulation
Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Inspired by Virtual Circuit Board and Turing Complete
- Retro aesthetic inspired by classic 8-bit games
- Built with using vanilla JavaScript and HTML5 Canvas
- Special Thanks to OpenAI and COPILOT for helping create Graphics elements and all the documentation for this project.
Made with wires by Master-yug
Have fun building circuits!