chalk-animation
Colorful animations in terminal output
Available animations
| Name | Preview | |:---------:|:------------------------------------------:| | rainbow | | | pulse | | | glitch | | | radar | | | neon | | | karaoke | |
Install
$ npm i chalk-animationUsage
import chalkAnimation from 'chalk-animation';
chalkAnimation.rainbow('Lorem ipsum dolor sit amet');#### Start and stop
You can stop and resume an animation with stop() and start().
When created, the instance of chalkAnimation starts automatically.
const rainbow = chalkAnimation.rainbow('Lorem ipsum'); // Animation starts
setTimeout(() => {
rainbow.stop(); // Animation stops
}, 1000);
setTimeout(() => {
rainbow.start(); // Animation resumes
}, 2000);
#### Automatic stop
Anything printed to the console will stop the previous animation automatically
chalkAnimation.rainbow('Lorem ipsum');
setTimeout(() => {
// Stop the 'Lorem ipsum' animation, then write on a new line.
console.log('dolor sit amet');
}, 1000);#### Changing speed
Change the animation speed using a second parameter. Should be greater than 0, default is 1.
chalkAnimation.rainbow('Lorem ipsum', 2); // Two times faster than default