### Install chalk-animation Source: https://github.com/bokub/chalk-animation/blob/master/README.md Installs the chalk-animation package using npm. ```bash $ npm i chalk-animation ``` -------------------------------- ### Start and Stop chalk-animation Source: https://github.com/bokub/chalk-animation/blob/master/README.md Shows how to control an animation instance using the `stop()` and `start()` methods. The animation starts automatically upon creation. ```javascript const rainbow = chalkAnimation.rainbow('Lorem ipsum'); // Animation starts setTimeout(() => { rainbow.stop(); // Animation stops }, 1000); setTimeout(() => { rainbow.start(); // Animation resumes }, 2000); ``` -------------------------------- ### Manual Rendering and Frame Retrieval in chalk-animation Source: https://github.com/bokub/chalk-animation/blob/master/README.md Shows how to manually control animation frames using `render()` to display a frame and `frame()` to get the content of the next frame without automatically starting the animation. ```javascript const rainbow = chalkAnimation.rainbow('Lorem ipsum').stop(); // Don't start the animation rainbow.render(); // Display the first frame const frame = rainbow.frame(); // Get the second frame console.log(frame); ``` -------------------------------- ### Install chalk-animation Globally for CLI Use Source: https://github.com/bokub/chalk-animation/blob/master/README.md Installs the chalk-animation package globally, enabling its command-line interface (CLI) functionality. ```bash $ npm install --global chalk-animation ``` -------------------------------- ### chalk-animation CLI Help Output Source: https://github.com/bokub/chalk-animation/blob/master/README.md Displays the help message for the chalk-animation command-line interface, detailing its usage, available options like `--duration` and `--speed`, and a list of supported animation types. ```bash $ chalk-animation --help Colorful animations in terminal output Usage $ chalk-animation [options] [text...] Options --duration Duration of the animation in ms, defaults to Infinity --speed Animation speed as number > 0, defaults to 1 Available animations rainbow pulse glitch radar neon karaoke Example $ chalk-animation rainbow Hello world! ``` -------------------------------- ### Basic Usage of chalk-animation Source: https://github.com/bokub/chalk-animation/blob/master/README.md Demonstrates how to import the chalk-animation library and apply a rainbow animation to a string. ```javascript import chalkAnimation from 'chalk-animation'; chalkAnimation.rainbow('Lorem ipsum dolor sit amet'); ``` -------------------------------- ### Change Animated Text with replace() in chalk-animation Source: https://github.com/bokub/chalk-animation/blob/master/README.md Demonstrates how to dynamically change the text of an ongoing animation using the `replace()` method, allowing for seamless text updates. ```javascript let str = 'Loading...'; const rainbow = chalkAnimation.rainbow(str); // Add a new dot every second setInterval(() => { rainbow.replace(str += '.'); }, 1000); ``` -------------------------------- ### Automatic Animation Stop on Console Output Source: https://github.com/bokub/chalk-animation/blob/master/README.md Illustrates that any console output will automatically stop the currently running chalk-animation. ```javascript chalkAnimation.rainbow('Lorem ipsum'); setTimeout(() => { // Stop the 'Lorem ipsum' animation, then write on a new line. console.log('dolor sit amet'); }, 1000); ``` -------------------------------- ### Change Animation Speed in chalk-animation Source: https://github.com/bokub/chalk-animation/blob/master/README.md Explains how to adjust the animation speed by providing a second parameter to the animation function. The value should be greater than 0, with 1 being the default speed. ```javascript chalkAnimation.rainbow('Lorem ipsum', 2); // Two times faster than default ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.