A stunning cyberpunk-style animated background effect featuring matrix rain, interactive particles, and network visualizations. Perfect for gaming websites, tech portfolios, or any project that needs a futuristic aesthetic.
- ๐ง๏ธ Matrix Rain: Authentic matrix-style falling characters
- ๐ฏ Interactive Particles: Mouse-responsive hexadecimal particles
- ๐ Network Connections: Dynamic network visualization with data packets
- โ๏ธ Fully Configurable: Customize colors, speeds, and all visual effects
- ๐ฑ Responsive Design: Optimized for all screen sizes
- ๐จ CSS Integration: Themed CSS classes for seamless integration
- ๐ Performance Optimized: Efficient canvas rendering
- โฟ Accessibility: Supports reduced motion preferences
- Include the files in your project:
<link rel="stylesheet" href="cyber-matrix-particles.css">
<script src="cyber-matrix-particles.js"></script>- Add the CSS class to your body:
<body class="cyber-matrix-enabled">- Initialize the effect:
// Basic initialization
const particles = new CyberMatrixParticles();
// Or with custom options
const particles = new CyberMatrixParticles({
particleColor: '#ff6b6b',
particleDistance: 80,
showMatrixRain: true
});- Download all files from this repository
- Include the CSS and JS files in your project
- Follow the Quick Start guide above
<link rel="stylesheet" href="https://cdn.example.com/cyber-matrix-particles/cyber-matrix-particles.css">
<script src="https://cdn.example.com/cyber-matrix-particles/cyber-matrix-particles.js"></script>npm install cyber-matrix-particlesThe CyberMatrixParticles constructor accepts an options object with the following properties:
| Option | Type | Default | Description |
|---|---|---|---|
target |
HTMLElement | document.body |
Target element to append canvas to |
zIndex |
Number | -1 |
Z-index of the canvas |
autoInit |
Boolean | true |
Automatically initialize on creation |
| Option | Type | Default | Description |
|---|---|---|---|
backgroundGradient |
String | See default gradient | CSS gradient for canvas background |
| Option | Type | Default | Description |
|---|---|---|---|
particleDistance |
Number | 60 |
Distance between particles |
particleSpeed |
Number | 1.5 |
Movement speed of particles |
particleChars |
Array | ['0','1','A','B'...] |
Characters to display |
particleFont |
String | '14px "Courier New"' |
Font for particles |
particleColor |
String | '#00ff41' |
Default particle color |
particleHoverColor |
String | '#ff6b6b' |
Color when mouse hovers |
| Option | Type | Default | Description |
|---|---|---|---|
mouseRadius |
Number | 120 |
Mouse interaction radius |
mouseRepulsion |
Number | 15 |
Maximum repulsion distance |
| Option | Type | Default | Description |
|---|---|---|---|
showConnections |
Boolean | true |
Show network connections |
connectionColors |
Array | ['#00ff41','#0099cc','#00ff41'] |
Connection gradient colors |
connectionOpacity |
Number | 0.6 |
Maximum connection opacity |
dataPacketChance |
Number | 0.02 |
Chance of data packet appearance |
dataPacketColor |
String | '#ff6b6b' |
Color of data packets |
| Option | Type | Default | Description |
|---|---|---|---|
showMatrixRain |
Boolean | true |
Enable matrix rain effect |
matrixChars |
Array | ['0','1','ใข','ใซ'...] |
Characters for matrix rain |
matrixSpeed |
Number | 2 |
Speed of falling characters |
matrixFont |
String | '12px "Courier New"' |
Font for matrix characters |
matrixColor |
String | '#00ff41' |
Matrix rain color |
matrixHeadColor |
String | 'rgba(255,255,255,0.9)' |
Color of drop head |
matrixDropLength |
Number | 15 |
Maximum length of drops |
| Option | Type | Default | Description |
|---|---|---|---|
showGrid |
Boolean | true |
Show background grid |
gridSize |
Number | 50 |
Size of grid cells |
gridColor |
String | '#00ff41' |
Grid line color |
gridOpacity |
Number | 0.1 |
Grid opacity |
| Option | Type | Default | Description |
|---|---|---|---|
animationSpeed |
Number | 0.01 |
Overall animation speed |
pulseIntensity |
Number | 0.3 |
Intensity of particle pulsing |
The package includes several CSS classes for easy styling:
.cyber-matrix-enabled- Applied to body for background.cyber-container- Basic cyber-themed container.cyber-container.enhanced- Container with glow effect
.cyber-input- Cyber-themed input fields.cyber-button- Cyber-themed buttons
.cyber-text- Basic cyber text style.cyber-text.heading- Large heading style.cyber-text.subheading- Subheading style
.cyber-above- Sets z-index: 10.cyber-interactive- Sets z-index: 100 with pointer events
The effect automatically adapts to different screen sizes:
- Desktop: Full feature set with optimal performance
- Tablet: Adjusted particle density and effects
- Mobile: Optimized for touch devices with reduced complexity
The package respects user preferences:
- Reduced Motion: Simplified animations when
prefers-reduced-motionis set - High Contrast: Enhanced visibility in high contrast mode
- Screen Readers: Canvas is properly hidden from screen readers
const particles = new CyberMatrixParticles();
// Start animation
particles.start();
// Stop animation
particles.stop();
// Update configuration
particles.updateConfig({
particleColor: '#ff0000',
showMatrixRain: false
});
// Destroy instance
particles.destroy();const classic = new CyberMatrixParticles({
particleColor: '#00ff41',
particleHoverColor: '#ffffff',
matrixColor: '#00ff41',
backgroundGradient: 'linear-gradient(135deg, #000000 0%, #001100 50%, #000000 100%)',
showMatrixRain: true,
showGrid: false,
particleDistance: 60,
matrixSpeed: 1.5
});const neon = new CyberMatrixParticles({
particleColor: '#ff0080',
particleHoverColor: '#00ffff',
matrixColor: '#ff0080',
backgroundGradient: 'linear-gradient(135deg, #0a0a0a 0%, #2e1a2e 25%, #3e164e 50%, #460f60 75%, #2f0a3f 100%)',
showMatrixRain: true,
showGrid: true,
particleDistance: 70,
matrixSpeed: 2.5
});const minimal = new CyberMatrixParticles({
particleColor: '#ffffff',
particleHoverColor: '#cccccc',
matrixColor: '#666666',
backgroundGradient: 'linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%)',
showMatrixRain: false,
showGrid: true,
particleDistance: 80,
matrixSpeed: 1
});- โ Chrome 60+
- โ Firefox 55+
- โ Safari 11+
- โ Edge 79+
- โ Opera 47+
CyberMatrix-Particles/
โโโ cyber-matrix-particles.js # Main JavaScript file
โโโ cyber-matrix-particles.css # Styling and theme classes
โโโ demo.html # Interactive demo page
โโโ README.md # This file
๐ Live Demo - Experience the effect in action!
The live demo includes interactive controls for:
- Toggling effects on/off
- Adjusting colors and speeds
- Switching between presets
- Real-time configuration changes
You can also open demo.html locally in your browser for offline testing.
// Different effects on different containers
const header = new CyberMatrixParticles({
target: document.getElementById('header'),
showMatrixRain: false,
particleDistance: 100
});
const sidebar = new CyberMatrixParticles({
target: document.getElementById('sidebar'),
showGrid: false,
particleColor: '#ff6b6b'
});const particles = new CyberMatrixParticles();
// Change theme based on time of day
function updateTheme() {
const hour = new Date().getHours();
if (hour >= 18 || hour <= 6) {
particles.updateConfig({
particleColor: '#4a90e2',
matrixColor: '#4a90e2'
});
}
}import { useEffect, useRef } from 'react';
function CyberBackground() {
const particlesRef = useRef(null);
useEffect(() => {
const particles = new CyberMatrixParticles({
target: document.body
});
particlesRef.current = particles;
return () => particles.destroy();
}, []);
return null;
}<template>
<div ref="container"></div>
</template>
<script>
export default {
mounted() {
this.particles = new CyberMatrixParticles({
target: this.$refs.container
});
},
beforeUnmount() {
if (this.particles) {
this.particles.destroy();
}
}
}
</script>Effect not showing
- Ensure the canvas has proper z-index
- Check that the target element exists
- Verify CSS classes are applied
Performance issues
- Reduce
particleDistancefor fewer particles - Disable effects you don't need
- Lower
animationSpeedvalue
Mobile performance
- The effect automatically reduces complexity on mobile
- Consider disabling on very old devices
MIT License - feel free to use in personal and commercial projects.
Contributions are welcome! Please feel free to submit issues and pull requests.
- ๐ Live Demo - Interactive online demo
- ๐ Source Code - Browse the repository
- ๐ Report Issues - Found a bug? Let us know!
Created with โค๏ธ for the cyberpunk and web development communities.
Enjoy creating amazing cyberpunk experiences! ๐