ansilove.js

A script to display ANSi and artscene related file formats on web pages
Log | Files | Refs | README | LICENSE

example_usage.ans (1512B)


      1 [?33hAnsiLove.render("cl!-al02.ans", function (canvas, sauce) {
      2     document.getElementById("ansi-container").appendChild(canvas);
      3     console.log(sauce);
      4 }, {"bits": "9"});
      5 
      6 // And for producing extremely long files,
      7 // spanning multiple canvas elements by splitting every nth row...
      8 
      9 [?33hAnsiLove.splitRender("long_ansi.ans", function (canvases, sauce) {
     10     canvases.forEach(function (canvas) {
     11         canvas.style.verticalAlign = "bottom"; // For perfect, gap-less viewing
     12         document.getElementById("ansi-container").appendChild(canvas);
     13     });
     14     console.log(sauce);
     15 }, 27, {"bits": "8"});
     16 
     17 // And for ansimations...
     18 
     19 var controller = [?33hAnsiLove.animate("ansimation.ans", function (canvas, sauce) {
     20     document.getElementById("ansi-container").appendChild(canvas);
     21     console.log(sauce);
     22     controller.play(2800, function () {
     23         console.log("Finished Playing");
     24     });
     25 }, {"bits": "9"});