Sahli/ansilove.js/example/example_usage.ans
Iam Naughton Phier 413a4dad3e Adding ansilove.js
- admittedly this should probably be tracked via a link but
 ... not really sure how to do that and the last time I did it,
 I had massive issues with updating on other machines.
2014-10-10 00:57:21 +03:00

1.5 KiB

AnsiLove.render("cl!-al02.ans", function (canvas, sauce) {
document.getElementById("ansi-container").appendChild(canvas);
console.log(sauce);
}, {"bits": "9"});
 
// And for producing extremely long files,
// spanning multiple canvas elements by splitting every nth row...
 
AnsiLove.splitRender("long_ansi.ans", function (canvases, sauce) {
canvases.forEach(function (canvas) {
canvas.style.verticalAlign = "bottom"; // For perfect, gap-less viewing
document.getElementById("ansi-container").appendChild(canvas);
});
console.log(sauce);
}, 27, {"bits": "8"});
 
// And for ansimations...
 
var controller = AnsiLove.animate("ansimation.ans", function (canvas, sauce) {
document.getElementById("ansi-container").appendChild(canvas);
console.log(sauce);
controller.play(2800, function () {
console.log("Finished Playing");
});
}, {"bits": "9"});