This project is inpired from parrot.live.
Basically i wanted to make any gifs to ascii and make it dance on terminal hence the name asciidance.
So The process of getting this result for any gifs is:
- you need a gif
- we have to extract frames from gifs
- at last we have to turn those frames to ascii
All of this will happen behind the secene when you use asciidance
npm install asciidance
- You have to install
jp2a
on your computer - You have to put your gifs on a
gifs
folder - Everytime you run the code again (as you can see in a quick example above) you have to delete both
ascii
andframes
folder
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { bg: "light" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { chars: "!@#$%^&()_+" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { border: "border" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { flipx: "flipx" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { flipy: "flipy" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { size: "100x100" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { width: "20" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { frameRate: "10" });
const asciidance = require("asciidance");
asciidance("snoopdog.gif", { customColor: ["green"] });
const asciiDance = require("asciidance");
asciiDance("snoop.gif", {
bg: "dark",
chars: "danielcodex",
flipy: "flipy",
flipx: "flipx",
border: "border",
frameRate: "100",
customColor: ["green", "red", "cyan"]
});
Type: string
Your gif file name
Type: object
Default: undefined
Options for how you ascii should look like.
Type: string
Default: dark
The other option is light
Here is the example
Type: string
Default: ...',;:clodxkO0KXNWM
Here is the example
Type: string
Default: undefined
You can set it to border
Here is the example
Type: string
Default: undefined
You can flip the ascii in the x axis
Here is the example
Type: string
Default: undefined
you can flip the ascii in the y axis
Here is the example
Type: string
Default: The default is the largest image dimension that fits on your terminal link
The format which you write is NxN
. That's x in the middle.
Here is the example
Type: string
Default: 70
This default rate is originally from parrot.live source code.
But you can change it to any number you want
The rules of thumb is this:
the lower the number the faster the animation/dancing and the higher the number the slower the animation/dancing π
Here is the example
Type: array
Default: ["red", "yellow", "green", "blue", "magenta", "cyan", "white"]
You can give choose any color from default array.
This colors come from colors npm package.
Here is the example
Intentionally i run one code after 2s. Here is the link
For some reason which i don't know yet, if we remove this delay and run the code for the first time, the moment we run curl localhost:3000
we won't get any result in terminal.
So i suspect that the reason for that is because the ascii folder is not populated yet the moment the makeItDance()
is called.
That's why i delay the called for makeItDance()
function.
If you used a gifs which was really long (i haven't seen a long gifs myself π€π) you might not see anything on terminal the moment you run curl localhost:3000
.
In order for that to work just run the your code again and then run curl localhost:3000
(it will works, i promise)
Happy coding π€