JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q60924F
  • License MIT

Create CLI animations using text frames.

Package Exports

  • cli-frames

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-frames) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cli-frames PayPal Version Downloads Get help on Codementor

Create CLI animations using text frames.

cli-frames

Installation

$ npm i --save cli-frames

Example

// Dependencies
var CliFrames = require("cli-frames");

// Frames
const frames = [
    "╔════╤╤╤╤════╗\n" +
    "║    │││ \\   ║\n" +
    "║    │││  O  ║\n" +
    "║    OOO     ║",

    "╔════╤╤╤╤════╗\n" +
    "║    ││││    ║\n" +
    "║    ││││    ║\n" +
    "║    OOOO    ║",

    "╔════╤╤╤╤════╗\n" +
    "║   / │││    ║\n" +
    "║  O  │││    ║\n" +
    "║     OOO    ║",

    "╔════╤╤╤╤════╗\n" +
    "║    ││││    ║\n" +
    "║    ││││    ║\n" +
    "║    OOOO    ║"
];

// Load frames when creating the instance
new CliFrames({
    frames: ["5", "4", "3", "2", "1"]
  , autostart: {
        delay: 1000
      , end: function (err, data) {
            // Create another animation
            var animation = new CliFrames();
            animation.load(frames);
            animation.start({
                repeat: true
              , delay: 250
            });
        }
    }
});

Documentation

CliFrames(opt_options)

Creates a new instance of CliFrames.

Params

  • Object opt_options: An optional object containing:
  • frames (Array): The frames to be loaded.
  • autostart (Object): If provided, the animation will be autostarted. The object will be provided to start function.

Return

  • CliFrames The CliFrames instance.

load(options)

Loads the animation frames.

Params

  • Object options: An array of strings representing the animation frames.

Return

  • CliFrames The CliFrames instance.

start(options)

Starts the CLI animation.

Params

  • Object options: An object containing the following fields:
  • delay (Number): The frame delay in milliseconds (default: 100).
  • repeat (Boolean): If true, the animation will be repeated infinitely.

Return

  • CliFrames The CliFrames instance.

How to contribute

Have an idea? Found a bug? See how to contribute.

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

MIT © Ionică Bizău