
js-printer is a standalone and very small JavaScript library which enables you to present text letter by letter like a typewriter.
How to use it:
Load the JS file printer.js in your html page.
<script src="javascript/printer.js"></script>
Create text you want to present and specify the output container.
var str = 'echo Welcome!\n';
str += 'echo This is a demo of js-printer\n';
str += 'echo Thanks!\n';
str += 'exit\n';
Printer.init(str, {
selector: 'show-board', // target container
lnStr: 'root@demo ~/ # ' // prefix
}).print();Available options with defautls.
// animation speed "speed" : 50, // target container ID "selector" : 'canvas', // initial character "startIndex" : 0, // last character "endIndex" : 0, // cursor options "hasCur" : true, "curId" : 'cur', "curStr" : '_', "curStyle" : 'font-weight: bold;', "curSpeed" : 100, // prefix "lnStr": ""







