@figliolia/chalk-animation 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
# chalk-animation
|
|
2
2
|
|
|
3
|
-
[](https://github.com/bokub/chalk-animation/actions/workflows/run.yml)
|
|
4
|
-
[](https://www.npmjs.com/package/chalk-animation)
|
|
5
|
-
[](https://codecov.io/gh/bokub/chalk-animation)
|
|
6
|
-
[](https://www.npmjs.com/package/chalk-animation)
|
|
7
|
-
[](https://github.com/sindresorhus/xo)
|
|
8
|
-
|
|
9
3
|
> Colorful animations in terminal output
|
|
10
4
|
|
|
11
5
|
|
|
@@ -24,26 +18,26 @@
|
|
|
24
18
|
## Install
|
|
25
19
|
|
|
26
20
|
```bash
|
|
27
|
-
$ npm i chalk-animation
|
|
21
|
+
$ npm i @figliolia/chalk-animation
|
|
28
22
|
```
|
|
29
23
|
|
|
30
24
|
|
|
31
25
|
## Usage
|
|
32
26
|
|
|
33
27
|
```javascript
|
|
34
|
-
import
|
|
28
|
+
import { ChalkAnimation } from '@figliolia/chalk-animation';
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
ChalkAnimation.rainbow('Lorem ipsum dolor sit amet');
|
|
37
31
|
```
|
|
38
32
|
|
|
39
33
|
#### Start and stop
|
|
40
34
|
|
|
41
35
|
You can stop and resume an animation with `stop()` and `start()`.
|
|
42
36
|
|
|
43
|
-
When created, the instance of
|
|
37
|
+
When created, the instance of ChalkAnimation **starts automatically**.
|
|
44
38
|
|
|
45
39
|
```javascript
|
|
46
|
-
const rainbow =
|
|
40
|
+
const rainbow = ChalkAnimation.rainbow('Lorem ipsum'); // Animation starts
|
|
47
41
|
|
|
48
42
|
setTimeout(() => {
|
|
49
43
|
rainbow.stop(); // Animation stops
|
|
@@ -60,7 +54,7 @@ setTimeout(() => {
|
|
|
60
54
|
Anything printed to the console will stop the previous animation automatically
|
|
61
55
|
|
|
62
56
|
```javascript
|
|
63
|
-
|
|
57
|
+
ChalkAnimation.rainbow('Lorem ipsum');
|
|
64
58
|
setTimeout(() => {
|
|
65
59
|
// Stop the 'Lorem ipsum' animation, then write on a new line.
|
|
66
60
|
console.log('dolor sit amet');
|
|
@@ -72,7 +66,7 @@ setTimeout(() => {
|
|
|
72
66
|
Change the animation speed using a second parameter. Should be greater than 0, default is 1.
|
|
73
67
|
|
|
74
68
|
```javascript
|
|
75
|
-
|
|
69
|
+
ChalkAnimation.rainbow('Lorem ipsum', 2); // Two times faster than default
|
|
76
70
|
```
|
|
77
71
|
|
|
78
72
|
#### Changing text
|
|
@@ -81,7 +75,7 @@ Change the animated text seamlessly with `replace()`
|
|
|
81
75
|
|
|
82
76
|
```javascript
|
|
83
77
|
let str = 'Loading...';
|
|
84
|
-
const rainbow =
|
|
78
|
+
const rainbow = ChalkAnimation.rainbow(str);
|
|
85
79
|
|
|
86
80
|
// Add a new dot every second
|
|
87
81
|
setInterval(() => {
|
|
@@ -94,7 +88,7 @@ setInterval(() => {
|
|
|
94
88
|
Manually render frames with `render()`, or get the content of the next frame with `frame()`
|
|
95
89
|
|
|
96
90
|
```javascript
|
|
97
|
-
const rainbow =
|
|
91
|
+
const rainbow = ChalkAnimation.rainbow('Lorem ipsum').stop(); // Don't start the animation
|
|
98
92
|
|
|
99
93
|
rainbow.render(); // Display the first frame
|
|
100
94
|
|
|
@@ -102,45 +96,6 @@ const frame = rainbow.frame(); // Get the second frame
|
|
|
102
96
|
console.log(frame);
|
|
103
97
|
```
|
|
104
98
|
|
|
105
|
-
|
|
106
|
-
## CLI mode
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# Install package globally
|
|
110
|
-
$ npm install --global chalk-animation
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
$ chalk-animation --help
|
|
115
|
-
|
|
116
|
-
Colorful animations in terminal output
|
|
117
|
-
|
|
118
|
-
Usage
|
|
119
|
-
$ chalk-animation <name> [options] [text...]
|
|
120
|
-
|
|
121
|
-
Options
|
|
122
|
-
--duration Duration of the animation in ms, defaults to Infinity
|
|
123
|
-
--speed Animation speed as number > 0, defaults to 1
|
|
124
|
-
|
|
125
|
-
Available animations
|
|
126
|
-
rainbow
|
|
127
|
-
pulse
|
|
128
|
-
glitch
|
|
129
|
-
radar
|
|
130
|
-
neon
|
|
131
|
-
karaoke
|
|
132
|
-
|
|
133
|
-
Example
|
|
134
|
-
$ chalk-animation rainbow Hello world!
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
## Related
|
|
139
|
-
|
|
140
|
-
- [gradient-string](https://github.com/bokub/gradient-string) - Output gradients to terminal
|
|
141
|
-
- [chalk](https://github.com/chalk/chalk) - Output colored text to terminal
|
|
142
|
-
|
|
143
|
-
|
|
144
99
|
## License
|
|
145
100
|
|
|
146
|
-
MIT © [
|
|
101
|
+
MIT © [Alex Figliolia](https://github.com/alexfigliolia)
|