Skip to main content
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:

  1. Make sure you have Node.js installed on your system.
  2. Navigate to the project directory in your terminal.
  3. Run the playground using the command:
node playground.js
  1. Once the playground starts, you can enter commands to test different features:
  • type: Demonstrates typing animation
  • glitch: Applies a glitch effect to the screen
  • sound: Plays a sound (ensure you have a sound file path configured)
  • countdown: Starts a 10-second countdown
  • box: Displays text in an ASCII box
  • scroll: Shows hacker-style scrolling text
  • help: Lists all available commands
  • clear: Clears the output screen
  • exit: Quits the playground
  1. 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

  • text string The text to animate.
  • element blessed.Widgets.BoxElement The blessed element to render the text in.
  • callback function? Optional callback to run after animation completes.
  • speed number The speed of typing in milliseconds. (optional, default 50)

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

  • screen blessed.screen The blessed screen object.
  • duration number Duration of the glitch effect in milliseconds. (optional, default 500)

Examples

const screen = blessed.screen();
glitchEffect(screen, 1000);

playSound

Plays a sound file using the system's default audio player.

Parameters

  • soundFile string Path to the sound file.

Examples

playSound('path/to/cyberpunk_ambience.mp3');

startCountdown

Creates a countdown timer on the screen.

Parameters

  • screen blessed.screen The blessed screen object.
  • seconds number The number of seconds to count down from.
  • callback function 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

  • content string 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

  • screen blessed.screen The blessed screen object.
  • lines Array<string> Array of strings to scroll.
  • speed number Speed of scrolling in milliseconds. (optional, default 100)

Examples

const screen = blessed.screen();
const hackerLines = ["Accessing mainframe...", "Bypassing firewall...", "Download complete."];
hackerScroll(screen, hackerLines);