Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ascii-frames with all npm packages installed. Try it out:

var asciiFrames = require("ascii-frames")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ascii-frames v0.2.0

Create ASCII animations in Terminal using ASCII frames.

ASCII Frames

Create ASCII animations in Terminal using ASCII frames.

Methods

loadFrames (options)

The options parameter is an array of strings representing the frames.

In the future it will can be an object.

startAnimation (options)

The options parameter is an object containing the following fields:

  • frameDelay: (number) the delay in miliseconds
  • repeat: (boolean) repeat animation after end

Example

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

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

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

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

    // require the library
  , AsciiFrames = require("../index")

    // create a new instance
  , animation = new AsciiFrames ();

// load frames
animation.loadFrames(frames);

// and start animation
animation.startAnimation({

    // repeat
    repeat: true

    // 250 ms
  , frameDelay: 250
});

How to test

$ npm install ascii-frames
$ cd node_modules
$ npm test

Changelog

v0.2.0

  • Use process.stdout instead of console.log.

v0.1.2

  • Fixed the condition for animation end when repeat is not true

v0.1.0

  • Initial release

License

See the LICENSE file.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free