animatrix

This program written in C will create some basic animation of ascii-art loaded from a txt file, while rendering the matrix effect in the terminal window.

Stale Pure Nim score 24/100 · last commit 2024-11-05 · 5 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Unknown
CI Status Failing
Stars 5
Forks 0
Open Issues 0
Last Commit 2024-11-05
Downloads 0
Last Indexed 2026-09-06 06:05

Installation

nimble install animatrix
choosenim install animatrix
git clone https://gitlab.com/christosangel/animatrix

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
animatrix - - - - - - -

README

animatrix

This program written in C will create some basic animation of ascii-art loaded from a txt file, while rendering the matrix effect in the terminal window.


video{height=300}



HOW TO CREATE SUITABLE ASCII-ART txt FILES

This program renders ascii-art txt files that are contain these characters: " (white space), 1,2,3).

In order to produce this kind of txt files, the program jp2a is used (https://github.com/cslarsen/jp2a).

To install this program in Debian-base OSs:

apt-get install jp2a

To generate an ascii-art txt file from a png image, in order to use it with animatrix, run the following command:

jp2a path/to/image.png --chars="01234567" --height=20>path/to/output.txt

In order to get ascii-art of a word/small text, there are two solutions: * Use convert:

convert -background white -fill black -pointsize 50 label:"Word here" word.png

  • Take a screenshot of the word, and work with it.

Since there are only two colors in such image, and the geometry of the image is different, the flags of the following jp2a should be adjusted accordingly:

 jp2a word.png --chars="01" --height=15>word.txt

NOTICE: As many times the output of the jp2a command is not optimal, the user is encouraged to edit the txt file using a text editor, in order to get the desired result.


INSTALL animatrix

  • Clone the repo, and change directory to animatrix/:
git clone https://gitlab.com/christosangel/animatrix.git&&cd animatrix
  • Compile animatrix.c, in order to create the executable:
gcc animatrix.c -Wall -o animatrix

USAGE

Once you have generated the ascii-art txt file that you want to show, open a terminal window (max size 540x134), and from the animartix/ directory, run:

./animatrix -f path/to/ascii.txt

You may want to add the flags that you prefer in order to have an outcome of your liking.

FLAGS

The user can either use the short or the long flag version (i.e. animatrix -h and animatrix --help are the same).

n Short flag Long flag Explanation
1 -h --help Shows this help text.
2 -f --file Defines the path to the ascii txt file to render in the center of the matrix window. If this flag isn't used, the command will still render a matrix screen with no ascii art.
3 -s --speed Defines the speed of the matrix falling digits. Acceptable values 0-9 (default: 5).
4 -d --dense Defines the density of the matrix lines. Acceptable values 0-9 (default: 5).
5 -m1 --matrix-color1 Defines the color of first matrix digits (default: yellow).
6 -m2 --matrix-color2 Defines the color of matrix digits (default: green).
7 -c1 --color1 The first color of the ascii art (default: blue).
8 -c2 --color2 The second color of the ascii art (default: red).
9 -c3 --color3 The third color of the ascii art (default: white).
10 -c4 --color4 The fourth color of the ascii art (default: yellow).
11 -c5 --color5 The fifth color of the ascii art (default: green).
12 -c6 --color6 The sixth color of the ascii art (default: grey).
13 -c7 --color7 The seventh color of the ascii art (default: black).
Acceptable color values
black, maroon, green, olive, navy, purple, teal, silver, grey, red, lime, yellow, blue, fuchsia, aqua , white These colors are defined by the color profile of your terminal.
14 -i --invert Inverts the colors of the ascii art (background-foreground).
15 -a1 --ascii1 Defines the characters for the first category of the ascii art (default: L).
16 -a2 --ascii2 Defines the characters for the second category of the ascii art (default: L).
17 -a3 --ascii3 Defines the characters for the third category of the ascii art (default: L).
18 -a4 --ascii4 Defines the characters for the fourth category of the ascii art (default: L).
19 -a5 --ascii5 Defines the characters for the fifth category of the ascii art (default: L).
20 -a6 --ascii6 Defines the characters for the sixth category of the ascii art (default: L).
21 -a7 --ascii7 Defines the characters for the seventh category of the ascii art (default: L).
Acceptable -a{1..7} values :
L Random uppercase letters [A-Z]
l Random lowercase letters [a-z]
n Random numbers [0-9]
s Space (best used in combination with -i or -d 9)
X the letter X
p Random punctuation marks '()\*+,-./
23 -A --animation Defines the mode of animation of the ascii-art on the terminal window (default: pong).
Acceptable -A values :
horizontal Ascii-art bounces horizontally.
vertical Ascii-art bounces vertically.
bounce Ascii-art bounces up and down in the terminal window.
scroll Ascii-art scrolls towards right direction.
scrollleft Ascii-art scrolls towards left direction.
scrollup Ascii-art scrolls upwards.
scrolldown Ascii-art scrolls downwards.
hop Ascii-art hops and bounces under gravity.
hopscroll Ascii-art scrolls right while bouncing under gravity.
hopscrollleft Ascii-art scrolls left while bouncing under gravity.
saw Ascii-art scrolls right while bouncing up and down.
sawleft Ascii-art scrolls left while bouncing up and down.
sawup Ascii-art scrolls up while bouncing left and right .
sawdown Ascii-art scrolls down while bouncing left and right .
pong Ascii-art bounces around in the terminal window.
slide Ascii-art slides right in the terminal window.
slideleft Ascii-art slides left in the terminal window.
demo Alternating all animation modes one by one.
shuffle Alternating all animation modes randomly.
none No animation, ascii-art remains stable and centered.
24 -H --hide-matrix Hides matrix effect, only ascii art animation is produced.
25 -D --duration Defines the duration of each animation during shuffle or demo mode, in cycles. Acceptable values: minimum 10
26 -S --slide Defines the duration of the image staying still in slide mode, in cycles. Acceptable values: minimum 1

Some sample ascii txt files were added to the repo, just to help with usage of the program.

Feel free to submit your ascii-art txt files, in order to enrich this small collection, making it available to many others.


This project came as an evolution of another quite similar project:

https://gitlab.com/christosangel/ascii-matrix

You may also want to check the evolution of this project:

https://gitlab.com/christosangel/chaftrix