HTML
cybermaint-toolkit
Reusable helpers for cyberpunk toolkit
- Commits
- 5
- Files
- 9.0K
- Size
- 45.5 MB
- Langs
- 3
- Created
- Jun 30, 2024
- Last push
- about 2 years ago
README.md
Cybermaint Toolkit
A toolkit for creating cyberpunk-style tools with immersive features.
Using the Playground
The Cybermaint Toolkit comes with a playground where you can interactively test all the features. To use the playground:
- Make sure you have Node.js installed on your system.
- Navigate to the project directory in your terminal.
- Run the playground using the command:
node playground.js
- Once the playground starts, you can enter commands to test different features:
type: Demonstrates typing animationglitch: Applies a glitch effect to the screensound: Plays a sound (ensure you have a sound file path configured)countdown: Starts a 10-second countdownbox: Displays text in an ASCII boxscroll: Shows hacker-style scrolling texthelp: Lists all available commandsclear: Clears the output screenexit: Quits the playground
- Type your commands in the input box at the bottom of the screen and press Enter to execute.
Table of Contents
blessed
A toolkit for creating cyberpunk-style tools with immersive features.
animateTyping
Creates a typing animation effect for text.
Parameters
textstring The text to animate.elementblessed.Widgets.BoxElement The blessed element to render the text in.callbackfunction? Optional callback to run after animation completes.speednumber The speed of typing in milliseconds. (optional, default50)
Examples
const box = blessed.box({ width: '100%', height: '100%' });
screen.append(box);
animateTyping("Hello, Operator.", box, () => console.log("Animation complete!"));
glitchEffect
Applies a glitch effect to the screen content.
Parameters
screenblessed.screen The blessed screen object.durationnumber Duration of the glitch effect in milliseconds. (optional, default500)
Examples
const screen = blessed.screen();
glitchEffect(screen, 1000);
playSound
Plays a sound file using the system's default audio player.
Parameters
soundFilestring Path to the sound file.
Examples
playSound('path/to/cyberpunk_ambience.mp3');
startCountdown
Creates a countdown timer on the screen.
Parameters
screenblessed.screen The blessed screen object.secondsnumber The number of seconds to count down from.callbackfunction Function to call when countdown reaches zero.
Examples
const screen = blessed.screen();
startCountdown(screen, 60, () => console.log("Time's up!"));
Returns blessed.Widgets.BoxElement The countdown box element.
createAsciiBox
Creates a bordered box with ASCII-style borders.
Parameters
contentstring The content to put inside the box.
Examples
console.log(createAsciiBox("Welcome, Operator."));
Returns string The content wrapped in an ASCII border.
hackerScroll
Creates a "hacker-style" scrolling effect for an array of strings.
Parameters
screenblessed.screen The blessed screen object.linesArray<string> Array of strings to scroll.speednumber Speed of scrolling in milliseconds. (optional, default100)
Examples
const screen = blessed.screen();
const hackerLines = ["Accessing mainframe...", "Bypassing firewall...", "Download complete."];
hackerScroll(screen, hackerLines);