0.2.0 • Published 10 years ago
ascii-frames v0.2.0
ASCII Frames
Create ASCII animations in Terminal using ASCII frames.
Methods
loadFrames (options)
The options
parameter is an array of strings representing the frames.
In the future it will can be an object.
startAnimation (options)
The options
parameter is an object containing the following fields:
frameDelay
: (number) the delay in milisecondsrepeat
: (boolean) repeat animation after end
Example
// frames
var frames = [
"╔════╤╤╤╤════╗\n" +
"║ │││ \\ ║\n" +
"║ │││ O ║\n" +
"║ OOO ║",
"╔════╤╤╤╤════╗\n" +
"║ ││││ ║\n" +
"║ ││││ ║\n" +
"║ OOOO ║",
"╔════╤╤╤╤════╗\n" +
"║ / │││ ║\n" +
"║ O │││ ║\n" +
"║ OOO ║",
"╔════╤╤╤╤════╗\n" +
"║ ││││ ║\n" +
"║ ││││ ║\n" +
"║ OOOO ║"
]
// require the library
, AsciiFrames = require("../index")
// create a new instance
, animation = new AsciiFrames ();
// load frames
animation.loadFrames(frames);
// and start animation
animation.startAnimation({
// repeat
repeat: true
// 250 ms
, frameDelay: 250
});
How to test
$ npm install ascii-frames
$ cd node_modules
$ npm test
Changelog
v0.2.0
- Use
process.stdout
instead ofconsole.log
.
v0.1.2
- Fixed the condition for animation end when repeat is not
true
v0.1.0
- Initial release
License
See the LICENSE file.