https://github.com/pagoru/simple-text-spinner
https://github.com/pagoru/simple-text-spinner
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pagoru/simple-text-spinner
- Owner: pagoru
- License: mit
- Created: 2017-06-05T23:51:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-07T15:20:01.000Z (almost 9 years ago)
- Last Synced: 2025-01-28T19:48:45.031Z (over 1 year ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
This module was created to allow create easy animations with text in node.
[](https://www.npmjs.com/package/simple-text-spinner) [](https://opensource.org/licenses/MIT)
## Installation
```sh
npm install -S simple-text-spinner
```
## Usage
```js
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
```js
new SimpleTextSpinner({
tag: undefined,
interval: 100,
paused: false,
defaultPosition: 0,
pattern: ['⠇', '⠋', '⠙', '⠸', '⠴', '⠦'],
inverse: false
});
```