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.
This commit is contained in:
parent
b014ad9dc9
commit
413a4dad3e
8 changed files with 2774 additions and 0 deletions
2
ansilove.js/.tm_properties
Executable file
2
ansilove.js/.tm_properties
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
excludeInFileChooser = "{$excludeInFileChooser,reference}"
|
||||
TM_JSLINTMATE_JSLINT_OPTIONS_FILE = "$CWD/jslint.json"
|
||||
32
ansilove.js/LICENSE
Normal file
32
ansilove.js/LICENSE
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
Copyright (C) 2013 Andrew Herbert and Frederic Cambus.
|
||||
|
||||
AnsiLove.js™ is a trademark of Frederic Cambus, used with permission.
|
||||
https://github.com/andyherbert/ansilove.js
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction except as noted below, including without
|
||||
limitation the rights to use, copy, modify, merge, publish, distribute, and/or
|
||||
sublicense, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
- The Software and/or source code cannot be copied in whole and sold without
|
||||
meaningful modification for a profit.
|
||||
|
||||
- The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
213
ansilove.js/README.md
Normal file
213
ansilove.js/README.md
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
## Description
|
||||
|
||||
AnsiLove.js is a partial rewrite of [ansilove][1] and [AnsiLove-C][2] in the Javascript programming language. Unlike the original projects, AnsiLove.js enables artscene related file formats to be displayed directly on a webpage on the client-side, and supports ANSi (.ANS), PCBOARD (.PCB), BiNARY (.BIN), ADF (.ADF), iDF (.IDF), TUNDRA (.TND) and XBiN (.XB) formats.
|
||||
|
||||
AnsiLove.js supports the majority of options found in the original set of tools.
|
||||
|
||||
[ansilove™][1] is a trademark of Frederic Cambus.
|
||||
[AnsiLove-C™][2] is a trademark of Stefan Vogt, Brian Cassidy and Frederic Cambus.
|
||||
|
||||
AnsiLove.js has been tested on Safari, Firefox, and Chrome. Results may vary widely on Internet Explorer browsers.
|
||||
|
||||
## Features
|
||||
|
||||
- ANSi (.ANS) format support
|
||||
- PCBOARD (.PCB) format support
|
||||
- BiNARY (.BIN) format support
|
||||
- ADF (.ADF) format support (Artworx)
|
||||
- iDF (.IDF) format support (iCE Draw)
|
||||
- TUNDRA (.TND) format support
|
||||
- XBiN (.XB) format support
|
||||
- SAUCE (Standard Architecture for Universal Comment Extentions)
|
||||
- 80x25 font support
|
||||
- 80x50 font support
|
||||
- Amiga font support
|
||||
- iCE colors support
|
||||
|
||||
## Supported charsets
|
||||
|
||||
- IBM PC (Code page 437)
|
||||
- Baltic (Code page 775)
|
||||
- Cyrillic (Code page 855)
|
||||
- French Canadian (Code page 863)
|
||||
- Greek (Code pages 737 and 869)
|
||||
- Hebrew (Code page 862)
|
||||
- Icelandic (Code page 861)
|
||||
- Latin-1 (Code page 850)
|
||||
- Latin-2 (Code page 852)
|
||||
- Nordic (Code page 865)
|
||||
- Portuguese (Code page 860)
|
||||
- Russian (Code page 866)
|
||||
- Turkish (Code page 857)
|
||||
- Armenian
|
||||
- Persian (Iran System encoding standard)
|
||||
|
||||
## Usage
|
||||
|
||||
AnsiLove.render("example.bin", function (canvas, sauce) {
|
||||
document.body.appendChild(canvas);
|
||||
console.log(sauce);
|
||||
}, {"font": "80x25", "bits": "8", "icecolors": 0, "columns": 80, "thumbnail": 0});
|
||||
|
||||
For extremely large files, which may silently fail on some browsers when producing a single canvas element, the `splitRender` function will produce an array of canvas elements, which can then be stacked vertically in the browser to simulate a single, contiguous display. The value of `27` in the following example is the maximum amount of text-rows in used in each element.
|
||||
|
||||
When aligning these elements on a page there may be a small gap between each image. To correct this, simply apply the CSS style `vertical-align: bottom`, or apply it progmatically with a single line of Javascript.
|
||||
|
||||
AnsiLove.splitRender("long_ansi.ans", function (canvases, sauce) {
|
||||
canvases.forEach(function (canvas) {
|
||||
canvas.style.verticalAlign = "bottom"; // For perfect, gap-less viewing.
|
||||
document.body.appendChild(canvas);
|
||||
});
|
||||
console.log(sauce);
|
||||
}, 27, {"bits": "8"});
|
||||
|
||||
And for ANSImations, the animate function returns a controller object which when issued with the play() call, renders an ANSI at a pre-determined baud rate, and can be passed an additional function which is called upon completion.
|
||||
|
||||
var controller = AnsiLove.animate("ansimation.ans", function (canvas, sauce) {
|
||||
document.getElementById("example").appendChild(canvas);
|
||||
console.log(sauce);
|
||||
controller.play(14400, function () {
|
||||
console.log("Finished!");
|
||||
});
|
||||
}, {"bits": "9"});
|
||||
|
||||
If a function is passed after the options object of any method, then it will be called in the event that the file cannot be fetched, or if an error occured whilst attempting to interpret the file.
|
||||
|
||||
AnsiLove.render("example.ans", function (canvas, sauce) {
|
||||
...
|
||||
}, {}, function (message) {
|
||||
alert("Error: " + message);
|
||||
});
|
||||
|
||||
### PC font options:
|
||||
|
||||
- 80x25 (Default, code page 437)
|
||||
- 80x25small (small, but legible code page 437)
|
||||
- 80x50 (Code page 437, 80x50 mode)
|
||||
- armenian
|
||||
- baltic (Code page 775)
|
||||
- cyrillic (Code page 855)
|
||||
- french-canadian (Code page 863)
|
||||
- greek (Code page 737)
|
||||
- greek-869 (Code page 869)
|
||||
- hebrew (Code page 862)
|
||||
- icelandic (Code page 861)
|
||||
- latin1 (Code page 850)
|
||||
- latin2 (Code page 852)
|
||||
- nordic (Code page 865)
|
||||
- persian (Iran System encoding standard)
|
||||
- portuguese (Code page 860)
|
||||
- russian (Code page 866)
|
||||
- terminus (Terminus font)
|
||||
- turkish (Code page 857)
|
||||
|
||||
### Amiga font options:
|
||||
|
||||
- amiga (alias to Topaz)
|
||||
- b-strict (Original B-Strict font)
|
||||
- b-struct (Original B-Struct font)
|
||||
- microknight (Original MicroKnight version)
|
||||
- microknight+ (Modified MicroKnight version)
|
||||
- microknightplus (alias to MicroKnight + to be used in URLs)
|
||||
- mosoul (Original mO’sOul font)
|
||||
- pot-noodle (Original P0T-NOoDLE font)
|
||||
- topaz (Original Topaz Kickstart 2.x version)
|
||||
- topaz+ (Modified Topaz Kickstart 2.x+ version)
|
||||
- topazplus (alias to Topaz+ to be used in URLs)
|
||||
- topaz500 (Original Topaz Kickstart 1.x version)
|
||||
- topaz500+ (Modified Topaz Kickstart 1.x version)
|
||||
- topaz500plus (alias to Topaz500+ to be used in URLs)
|
||||
|
||||
|
||||
### Bits options
|
||||
|
||||
- "8" (8-bit): Default rendering mode.
|
||||
- "9" (9-bit): Renders the 9th column of block characters, causing the output to look like it’s displayed in real textmode.
|
||||
- "ced": Renders files in black on gray, and limit the output to 78 columns (only available in ANSi loader). Used together with an Amiga font, the output will look like it is displayed on Amiga.
|
||||
- "workbench": Renders files using Amiga Workbench colors (only available in ANSi loader).
|
||||
|
||||
### iCE colors options
|
||||
|
||||
- 0 (default, turned OFF)
|
||||
- 1 (turned ON)
|
||||
|
||||
### Columns options
|
||||
|
||||
Used for .BIN files only. Skip this option when converting other formats. The default is set at 160.
|
||||
|
||||
### Thumbnail options
|
||||
|
||||
- 0 (default, turned OFF)
|
||||
- 1 (1/8 scale)
|
||||
- 2 (1/4 scale)
|
||||
- 3 (1/2 scale)
|
||||
|
||||
A thumbnail image is rendered instead of a full-size image. Does not apply when playing ansimations.
|
||||
|
||||
### Filetype options
|
||||
|
||||
- ans
|
||||
- txt
|
||||
- nfo
|
||||
- asc
|
||||
- diz
|
||||
- ion
|
||||
- adf
|
||||
- bin
|
||||
- idf
|
||||
- pcb
|
||||
- tnd
|
||||
- xb
|
||||
|
||||
Instead of guessing the filetype based on the name or extension of the url, the chosen rendering method can be chosen from this list by using the option `"filetype": "<type>"`. Using this method, it is possible to display the raw data contained within a file by over-riding this property with `"asc"`.
|
||||
|
||||
### 2x options
|
||||
|
||||
- 0 (default, turned OFF)
|
||||
- 1 (turned ON)
|
||||
|
||||
Delivers a canvas element which has double the width and height in pixels, but styled in half these amounts in CSS-pixels. This makes it suitable for display on devices with high pixel densities.
|
||||
|
||||
### SAUCE record
|
||||
|
||||
As well as a canvas element, a [SAUCE][3] record is returned as a Javascript object if one is found, and follows this format:
|
||||
|
||||
{
|
||||
"version": "00",
|
||||
"title": "Example ANSI",
|
||||
"author": "Joe Q. Public",
|
||||
"group": "Generic Ansi Group",
|
||||
"date": "20130922",
|
||||
"fileSize": 1337,
|
||||
"dataType": 1,
|
||||
"fileType": 1,
|
||||
"tInfo1": 80,
|
||||
"tInfo2": 26,
|
||||
"tInfo3": 0,
|
||||
"tInfo4": 0,
|
||||
"comments": ["Comment 1.", "Comment 2.", ... ],
|
||||
"flags": 0
|
||||
}
|
||||
|
||||
It is also possible to retrieve a record for a file without generating an image by using the `sauce` function.
|
||||
|
||||
AnsiLove.sauce("example.ans", function (sauce) {
|
||||
console.log(sauce);
|
||||
});
|
||||
|
||||
## License
|
||||
|
||||
AnsiLove.js is released under a MIT-style license. See `LICENSE` file for details.
|
||||
|
||||
## Author
|
||||
|
||||
AnsiLove is developed by [Frederic Cambus](http://www.cambus.net)
|
||||
AnsiLove.js is developed by [Andrew Herbert](http://andyh.org)
|
||||
|
||||
## Resources
|
||||
|
||||
Project Homepage : [https://github.com/andyherbert/ansilove.js](https://github.com/andyherbert/ansilove.js)
|
||||
|
||||
[1]: https://github.com/fcambus/ansilove
|
||||
[2]: https://github.com/ByteProject/AnsiLove-C
|
||||
[3]: http://web.archive.org/web/20120204063648/http://www.acid.org/info/sauce/sauce.htm
|
||||
2420
ansilove.js/ansilove.js
Normal file
2420
ansilove.js/ansilove.js
Normal file
File diff suppressed because one or more lines are too long
18
ansilove.js/example/cl!-al02.ans
Normal file
18
ansilove.js/example/cl!-al02.ans
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[0m
|
||||
[60C[1;30mþ ß ßßÛ[0m
|
||||
[16C[1;30mß[0m[22C[1;33;47m²[40mßß²²[0;30m [37m °°°°[4C[1;30mÜ[0m [1;30mß[31m ÜÜ[47m²²±°[36m°°[0m [1;30m²[0m
|
||||
[16C[1;30mÛ ß Ü[0m[18C[1;33;47m±[0m [1;31;41m²[33;47m²²[31;43m²²[47mß[41m±[0m°°[1;30m þß[0m [1;31mÜÜ[43m²²[47m²²ÛÛ²²±°[0m [1;30m²[0m
|
||||
[16C[1;30mÛ[0m [1;31;43m²[40mÜ[30m ßþÜ[0m[10C[1;30mÜ[0m[4C[1;33;47m°[0m [1;31;47m²[33m±±[31;43m²[47mÜ[33mß[31mÜ[0m [1;30mþ[0m [1;31mÜ[43m²²[47mß[33mÜ[31mßÛÛ[43m²²²[47mÛÛ²±[0m [1;30m±[0m
|
||||
[7C[1;30mÜ[0m[7C[1;30mÞÝ[31mÞ[43m²²[40mÛÛÜÜ [30mßÛ[0m[5C[1;30mþ[0m [1;30mÜ[0m[4C[1;30;47m°[0m [1;31;47m²[33m°°[31m²[43m²[41m±[0;33mß[37m [1;31mÜ[43m²Û[47m²²ÛÜ[43m²²[40mßß[43m±±²²[40mÛ[47m²[0m [1;30m°[0m
|
||||
[5C[1;31;47m±[0mÜ [1;30m Ü[0m[5C[1;30mß [31;41mÛÛ[47mß[33mÜ[31mß[40mÛ[43m²²[40m [30mÛ[0m [1;30mÜþ[0m [1;31mÜ[43m²[0m [1;30mÛ[0m[4C[1;30;47m±[0m [1;31;43m²[47m°°²[41m±[0;33mß[1;31m [43m²²Û[47mÛÛ[43m²²[40mß[0m [1;30mÜ[31m [30;43m°[31m°°±±[40mßß[0m [1;30mþÜ[0m [1;30mß[0m [1;30mþ[0m
|
||||
[5C[1;31;47m°±²[40mÜ[0m [1;30mßÜ[0m [1;30mÜß[0m [1;31;43m²²[41mÛ[40mÛ[47mÜ[40mÛÛÛ[43m²[40m [30mß[31m ÜÜÛ[43m²²[40m [30mÞÝ[0m [1;30m [47m²[0m [1;31mÛ[47m±±[43m²[0;33mÝ[37m [1;31mÛ[47mß[37mÜ[31mß[43m²²[40mß[0m [1;30mÜ Ü[0m [1;30;43m°[0;33mßß[37m [1;30mÜþ[33m Üß[47m²[40mÜ Ü[47m²²[40mÜ [30mþ[0m
|
||||
[5C[1;33;47m°[0m [1;31mß[47m²²[40mÜ[0m [1;30mß[0m [1;31mÜÛ[47mß[36mÜ[31mß[40mÛ[47m²²[40mÛÛÜÜ[43m²²[40mÛÛ[47mß[33mÜ[31mß[40mÝ[30m Ü[0m [1;30mÜ[0m [1;31;43m²[47m²²[41m±[0m [1;31mÞ[43m²Û[47mÜ[43mÛ²[40mÝ [30mÛ ²Ü þß [0m [1;33mÞÝ[36mÞ[47m²[33m²[40mÛÛ[36;47m²[33m²²[40mÝ[0m [1;30mÜ[0m
|
||||
[5C[1;33;47m±[0m Ü [1;31mß[43m²[40mß[0;33mÜ[1;31;41m±[43m²²[40mÛ[47mÜ[40mÛ[43m²[40mÜÛÛÛ[47m²²[40mÛ[43m²²Û[40mÛ[47mÜ[40mÛ[43m²[0m [1;30mßÜ[0m [1;30m²[0m [1;31;41m±[43m²[41mÛ[43m²[0;33mÝ[37m [1;31;43m²²[47m²²ß[40mÛÜ[0m [1;30mßÜ[0m[7C[31mþ[1;33m ß²²ßÛ[36;47m²[33m²²[40mß [0mÜ
|
||||
[5C[1;33;47m²[0m [31mÜÜ[1;41m°°±±[43m²²[40mÛßÜÛ[43m²²[40mÛÛÛÛÛÛÛÜ[47m²²[40mÛ[47mß[40mÜ[0m [1;30mßÜ [0m [1;31;41m°±[43m²²[41m±[0;33mÜ[1;31m ß[43m²[47mÜ[33mß[31mÜ[40mÛ[43m²[40mÜÜ[0m [1;30mß[0mþ[5C[31mß[33mÜ[37m [1;33mßÛ[47m²²[40mß[0m Ü
|
||||
[5C[31mÜ[37m [31mß[30;41m°°[33m°°[1;31m°°±±[40mß[30mÜ [31;43m²[40mÛÛ[47m²²[40mÛ²Û[47mß[36mÜ[31mß[40mÛÜß[47mÜ[37mß[31mÜ[43m²[40mÜ[0m [1;30mß[0;31m [1;30;41m°[31m°±±[43m²²Ü[0m [1;31m ßß[43m²²[40mÛ[47mß[36mÜ[31mß[43m²[40mÜ [0mß[5C[1;31;43m±[40mÜ [33mß[0m Ü[1;31;43m²[0m [1;36mÜ[0m
|
||||
[1;30mßÜ[0m [31mßÜ[37m [31mß[30;41m°°[31;40mßß[37m [31mÜ[1;41m°[0;31mÜ[1;30m [31;41m±[43m²[40mÛÛÛÛ±[43mÛ[40mÛ[47mܲ²Û[40mÛ[0m [1;31mß[41mÛ[47mß[36mÜ[31mß[40mÜÜ[0;31mßß[1;41m°°±±±[0m [1;36;47m°[0mß[1;36mþÜ[31m ß[43m²[47mÜ[40mÛÛ[47m²²[0m ß ß[1;36mÛ[0m [1;31mÛ[47m²²[40mÜ[47mÜ[36mß[31mÜ[0m [1;36mß[0m
|
||||
[4C[1;30mßÜ[0m [31mß[37m Ü[1;36mþßÜ[0m [31mß[1;41m°°±±[43m²²[40mÛÛ°[43m²²²²²²²[0m [1;36mÜ[0m [1;31mß[47mÜ[41mÛÛ[43m²²[41m±[0;31mÜÜ[1;41m°°°[0m [30;47m°[37;40m [1;47m±[31;40m ÞÛ[47mß[36mÜ[31mß[40mÛÝ[0m [1m²[0m [1;36;47m²[0m [1;31;43m²²²²²²²[0m ß[1;30m Cl![0;35m°°°°[37m [1;33mÜ[0m [35m²[37m ß [35mÜÛÜ[37m [1mßÜ[0m [31mß[1;41m°°±±[43m²²[30;40m [31;41m±±±±±±±[0m [1mßþ[0m [1;31mßß[41m±±°°[0;33;41m°°[30m [37;40m [30;47m°[37;40m Üß [1;31mÜ[43m²[40mÛÛ[47mÜ[43m²²[0m [1mÜ[0m [1;36;47m±[0m [1;31;41m±±±±±±±[0m ²[35m °°°±±±±[37m [1;33mÛ[0m [35mÛÛÛÛÛÛÛÛÜ[37m [1mß[36mÜ[0m [31mß[1;41m°°±±[30;40m [31;41m°°°°°°°[0m [1;36mß[0m [35mÜ[37m [1;36mßß[0m ÜÜ [31mßßßß[37mÜß [33mÜ[1;31;43m±±²²[47m²²[40mÛ [37mÜ[0m [35mÜ[37m [1;36;47m°[0m [1;31;41m°°°°°°°[0m ±[35m ±±±²²ß[1;33mܲß[47m²[40mÜ[0;35mßÛÛÛÛÛÛÛÛÜ[37m [1;36mßþÜ[0mÜ Ü [31m²²²²²²²[37m ² [35mÛÛÛÛÜÜÜÜ[37m þß [31mÜÜ[1;41m°°±±[43m±±²²[40mß[0m [1;36mÜ[0m [35mÜÛ[37m Û [31m²²²²²²²[37m °[35m ²²²ÛÝ[1;33mÞ[47m²[0m [1;47m²[36m²[33m²[40mÝ[0;35mÞÛÛÛÛÛÛÛÛÛÛÜÜÜÜÜ[37m [31m±±±±±±±[37m [35mÜÜÛÛÛßßß[37m [31mÜ[37m [31mß[30;41m°°[33m°°°[1;31m°°[0;33mßß[37m Ü[1;36mþß[0m [35mÜÛÛ[37m Ü [31m±±±±±±±[35m ÜÜÛÛÛÛÛÜ[1;33mß²[47m²²[40mß[0;35mÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[37m [31m°°°°°°°[37m [35mÛÛÛÛÛÜ[37m [1;30mßÜ[31m [0;31mßÜ[1m [0;31mß[30;41m°[31;40mßß [37mÜ ß [35mÜÜÛÛÛÛÛÜÜ[37m [31m°°°°°°°[37m [35mÛÛÛÛÛÛÛÛÛÜÜÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÜÜÜÜÜÜÜÜÜÛÛÛÛÛÛÛÜ [1;30mßÜ[0m [31mß[37m Ü [1;30mß[0m [35mÜÜÛÛÛÛÛÛÛÛÛÛÛÜÜÜÜÜÜÜÜÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÜÜ[37m ß [35mÜÜÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ[1;32;45m [31m [32m [0;35mÛ[1;32;45mA[0;35mÛÛÛÛÛ[1;32;45mN[0;35mÛÛÛÛÛ[1;32;45mS[0;35mÛÛÛÛÛ[1;32;45mi[0;35mÛÛÛÛÛ[1;31;45m[0;35mÛÛÛÛÛ[1;32;45mL[0;35mÛÛÛÛÛ[1;32;45mO[0;35mÛÛÛÛÛ[1;32;45mV[0;35mÛÛÛÛÛ[1;32;45mE[0;35mÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²[37m
|
||||
Just create your own world,[22CCleaner[1;30m([0m27"[1;30m) [0m August 2004
|
||||
for the sake of art...[27Chttp[1;30m://[0mcleaner[1;30m.[0mplanet-d[1;30m.[0mnet
|
||||
[34C[30m þ A N S i þ[37m
|
||||
[0m
|
||||
25
ansilove.js/example/example_usage.ans
Normal file
25
ansilove.js/example/example_usage.ans
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[0;1;40;37m[?33hAnsiLove.[35mrender[0m([32m"cl!-al02.ans"[37m, [1;33mfunction [37m([0mcanvas[1m, [0msauce[1m) {
|
||||
document.[35mgetElementById[37m([0;32m"ansi-container"[1;37m).[35mappendChild[37m([0mcanvas[1m);
|
||||
[33mconsole[37m.log(sauce);
|
||||
}, {[0;32m"bits"[1;37m: [0;32m"9"[1;37m});
|
||||
|
||||
[0m// And for producing extremely long files,
|
||||
// spanning multiple canvas elements by splitting every nth row...
|
||||
|
||||
[0;1;40;37m[?33hAnsiLove.[35msplitRender[0m([32m"long_ansi.ans"[37m, [1;33mfunction [37m([0mcanvases[1m, [0msauce[1m) {
|
||||
canvases.[35mforEach[37m([1;33mfunction [37m([0mcanvas[1m) {
|
||||
canvas.[35mstyle[37m.[35mverticalAlign [37m= [0;32m"bottom"; [37m// For perfect, gap-less viewing
|
||||
[1mdocument.[35mgetElementById[37m([0;32m"ansi-container"[1;37m).[35mappendChild[37m([0mcanvas[1m);
|
||||
});
|
||||
[33mconsole[37m.log(sauce);
|
||||
}, [31m27[37m, {[0;32m"bits"[1;37m: [0;32m"8"[1;37m});
|
||||
|
||||
[0m// And for [5mansimations[25m...
|
||||
|
||||
[1;33mvar [1;37mcontroller = [0;1;40;37m[?33hAnsiLove.[35manimate[0m([32m"ansimation.ans"[37m, [1;33mfunction [37m([0mcanvas[1m, [0msauce[1m) {
|
||||
document.[35mgetElementById[37m([0;32m"ansi-container"[1;37m).[35mappendChild[37m([0mcanvas[1m);
|
||||
[33mconsole[37m.log(sauce);
|
||||
controller.play([31m2800[37m, [33mfunction [1;37m() {
|
||||
[33mconsole[37m.log([0;32m"Finished Playing"[1;37m);
|
||||
});
|
||||
}, {[0;32m"bits"[1;37m: [0;32m"9"[1;37m});
|
||||
48
ansilove.js/example/index.html
Normal file
48
ansilove.js/example/index.html
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>ansilove.js</title>
|
||||
<script src="../ansilove.js" type="text/javascript" charset="utf-8"></script>
|
||||
<style type="text/css" media="screen">
|
||||
body {
|
||||
background: black;
|
||||
}
|
||||
.center {
|
||||
margin: 0 auto;
|
||||
background-color: black;
|
||||
padding: 16px;
|
||||
}
|
||||
#header {
|
||||
width: 720px;
|
||||
height: 464px;
|
||||
}
|
||||
#example {
|
||||
width: 720px;
|
||||
height: 384px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" class="center"></div>
|
||||
|
||||
<div id="example" class="center"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var controller, retina;
|
||||
|
||||
retina = window.devicePixelRatio > 1;
|
||||
|
||||
AnsiLove.render("cl!-al02.ans", function (canvas, sauce) {
|
||||
document.getElementById("header").appendChild(canvas);
|
||||
}, {"bits": "9", "2x": (retina ? 1 : 0)});
|
||||
|
||||
controller = AnsiLove.animate("example_usage.ans", function (canvas, sauce) {
|
||||
document.getElementById("example").appendChild(canvas);
|
||||
controller.play(2800);
|
||||
}, {"bits": "9", "2x": (retina ? 1 : 0)});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
16
ansilove.js/jslint.json
Normal file
16
ansilove.js/jslint.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"bitwise": true,
|
||||
"browser": true,
|
||||
"devel": true,
|
||||
"plusplus": true,
|
||||
"predef": [
|
||||
"AnsiLove",
|
||||
"Uint8Array",
|
||||
"Uint32Array",
|
||||
"FileReader",
|
||||
"self",
|
||||
"onmessage",
|
||||
"postMessage",
|
||||
"Worker"
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue