digital-matrix-rain
Version:
A cool matrix-style digital rain animation for terminal/console applications
66 lines (56 loc) • 1.81 kB
JavaScript
/**
* Demo examples for Matrix Animation Package
*/
const { MatrixRain, matrix, demo } = require('../index.js');
console.log('🎬 Matrix Animation Demo\n');
// Demo 1: Basic green matrix
console.log('Demo 1: Classic Green Matrix (5 seconds)');
setTimeout(() => {
const greenMatrix = new MatrixRain({
color: 'green',
speed: 80,
density: 0.1
});
greenMatrix.run(5000);
// Demo 2: Red matrix after green one stops
setTimeout(() => {
console.log('\nDemo 2: Red Matrix (5 seconds)');
const redMatrix = new MatrixRain({
color: 'red',
speed: 60,
density: 0.15
});
redMatrix.run(5000);
// Demo 3: Cyan fast matrix
setTimeout(() => {
console.log('\nDemo 3: Fast Cyan Matrix (5 seconds)');
const cyanMatrix = new MatrixRain({
color: 'cyan',
speed: 40,
density: 0.2
});
cyanMatrix.run(5000);
// Demo 4: Multi-color showcase
setTimeout(() => {
console.log('\nDemo 4: Color Showcase');
const colors = ['green', 'red', 'blue', 'yellow', 'magenta', 'cyan'];
let colorIndex = 0;
const colorInterval = setInterval(() => {
if (colorIndex >= colors.length) {
clearInterval(colorInterval);
console.log('\n✨ Demo completed! Thank you for watching!');
return;
}
console.log(`\nShowing ${colors[colorIndex]} matrix...`);
const colorMatrix = new MatrixRain({
color: colors[colorIndex],
speed: 70,
density: 0.12
});
colorMatrix.run(2000);
colorIndex++;
}, 2500);
}, 6000);
}, 6000);
}, 6000);
}, 2000);