Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/nate-parrott/lettercrap

a Javascript library that generates dynamic ascii art on the web
https://github.com/nate-parrott/lettercrap

Last synced: 3 months ago
JSON representation

a Javascript library that generates dynamic ascii art on the web

Lists

README

        

# Lettercrap

_Lettercrap_ is a Javascript library that generates dynamic ascii art on the web, using an image mask. It looks like this:

[Here's a live demo](https://nate-parrott.github.io/lettercrap)

## Usage

To use _Lettercrap_, import `lettercrap.js` and `lettercrap.css`. Create a `div` with the `data-letter-crap` attribute with the source of a black-and-white image, which will serve as the shape of the generated ascii art:

Make sure to set a height for your `div`. If you want to set a dynamic height based on the div's fluid width, you can specify an aspect ratio using the `data-lettercrap-aspect-ratio` attribute, and _Lettercrap_ will set the height of the `div` for you:

By default, _Lettercrap_ uses `0`s, `1`s and the occasional `_` to fill in the shape of your image. You can change the set of letters used with the `data-lettercrap-letters` attribute:

_Lettercrap_ can also throw the occasional _full word_ into the mix—specify the words to choose from using the `data-lettercrap-words` attribute:

Check out the `examples/index.html` file to see exactly how this all fits together.