npm.io
1.0.16 • Published 9 years ago

simple-text-spinner

Licence
MIT
Version
1.0.16
Deps
0
Vulns
0
Weekly
0

This module was created to allow create easy animations with text in node.

npm version License: MIT

Installation

npm install -S simple-text-spinner

Usage

const SimpleTextSpinner = require('simple-text-spinner');

let spinner = new SimpleTextSpinner({options});

//Plays the current animation
spinner.play();
//Stops the current animation
spinner.pause();
//Inverts the animation
spinner.invert();

//Returns the current animation text
spinner.getText();
//Returns the percentatge amount of the animation
spinner.getPercentage();

//Sets the label that will affect the animation, can be undefined.
//Works like jquery ('.class', '#id', 'div')
spinner.setTag(str);
//Sets the interval between every frame of the animation
spinner.setInterval(int);

//Returns if the animations is paused
spinner.isPaused();

//Prints in console the current text
spinner.print();
Options
new SimpleTextSpinner({
  tag: undefined,
  interval: 100,
  paused: false,
  defaultPosition: 0,
  pattern: ['⠇', '⠋', '⠙', '⠸', '⠴', '⠦'],
  inverse: false
});

Keywords