m4444 / tmatrix Goto Github PK
View Code? Open in Web Editor NEWTerminal based replica of the digital rain from The Matrix.
License: GNU General Public License v2.0
Terminal based replica of the digital rain from The Matrix.
License: GNU General Public License v2.0
In Termux running on Android 8.1, compilation fails with the following error:
ata/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: CMakeFiles/tmatrix.dir/src/tmatrix.cpp.o: in function `resizeHandler(int)':
tmatrix.cpp:(.text+0x18): undefined reference to `__atomic_store_1'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: CMakeFiles/tmatrix.dir/src/tmatrix.cpp.o: in function `render(RainProperties const&)':
tmatrix.cpp:(.text+0xf4): undefined reference to `__atomic_load_1'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: tmatrix.cpp:(.text+0x118): undefined reference to `__atomic_store_1'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/tmatrix.dir/build.make:191: tmatrix] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/tmatrix.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
This is fixed by explicitly linking atomic
in CMakeLists.txt
.
I am surprised by how great TMatrix's output is, the gradient looks amazing, and I think another good feature would be giving more control on which characters are shown.
The idea comes from will8211/unimatrix and the implementation there is actually very simple, there are two command-line parameters, one for predetermined charsets and other for custom characters. I believe even just one of the two strategies would already be a good additioon to TMatrix, and sooner or later I'll probably implement this to some extent even if just for me to use it, so I may be able to send a PR.
The implementation on Unimatrix is pretty simple:
First there's an Object/Hash/etc with the predefined charsets:
char_set = {
'a': 'qwertyuiopasdfghjklzxcvbnm',
'A': 'QWERTYUIOPASDFGHJKLZXCVBNM',
'c': 'абвгдежзиклмнопрстуфхцчшщъыьэюя',
'C': 'АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ',
'e': '☺☻✌♡♥❤⚘❀❃❁✼☀✌♫♪☃❄❅❆☕☂★',
'g': 'αβγδεζηθικλμνξοπρστυφχψως',
'G': 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ',
'k': 'ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン',
'm': 'ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン1234567890'
'1234567890-=*_+|:<>"-=*_+|:<>"-=*_+|:<>"-=*_+|:<>"',
'n': '1234567890',
'o': 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'
'`-=~!@#$%^&*()_+[]{}|\;\':",./<>?"',
'p': '',
'P': '',
'r': 'mcclllxxxxvvvvviiiiii',
'R': 'MCCLLLXXXXVVVVVIIIIII',
's': '-=*_+|:<>"',
'S': '`-=~!@#$%^&*()_+[]{}|\;\':",./<>?"',
'u': args.custom_characters}
Then for the charsets option just concatenate the characters for each specified Charset into a Variable with all possible characters. And to make things even simpler, the custom characters passed through the parameter are saved as one of the charsets:
# "-l" option has been used
if args.character_list:
chars = ''
for letter in args.character_list:
try:
chars += char_set[letter]
except KeyError:
print("Letter '%s' does not represent a valid character list."
% letter)
exit()
And just pick a random character from the all-possible-characters variable to display:
@staticmethod
def get_char():
"""
Returns a random character from the active character set
"""
return chars[randint(0, chars_len)]
This has the advantage of specifying not only which characters are available but also how common or rare each character is.
I'd probably use a lambda for the "m" charset and maybe using a lambda or something to generate charsets in a cleaner way
In Ruby (which is my go-to language) for instance, I can do stuff like this:
irb(main):019:0> puts ("A".."z").to_a.join.concat (0..9).to_a.join
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz0123456789
So putting that together with my love for hackish stuff, I'd most likely consider taking arguments formatted as something like:
--custom="0..9,A..Z, ,a..z,12345"
...so I could do this kinda madness:
irb(main):009:1* "0..9,A..Z, ,a..z,12345".split(",").map{|i|
irb(main):010:1* next i.to_s unless i.match? /^.\.\..$/
irb(main):011:1* i.split("..").inject{|f,l|(f..l).to_a.join}
irb(main):012:0> }.join
=> "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz12345"
Or the slightly more readable and less quirky:
irb(main):014:0> input = "0..9,A..Z, ,a..z,12345"
irb(main):015:1* input.split(",").map{|item|
irb(main):016:2* if item.match? /^.\.\..$/
irb(main):017:2* item.split("..").inject{|first,last|(first..last).to_a.join}
irb(main):018:2* else
irb(main):019:2* item.to_s
irb(main):020:1* end
irb(main):021:0> }.join
=> "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz12345"
Pretty neat for less than 10 lines of code, if I do say so myself... And I think this covers pretty much everything I might want.
I am also interested in contributing to TMatrix and was wondering if you could guide me on how to modify the source code to implement transparent background support myself. Could you point me to the part of the code that handles background rendering, or any tips on where to start looking?
Any guidance would be greatly appreciated, as I am keen to contribute to the project and potentially submit a pull request once I manage to implement this feature.
The current instructions tell to enable repository bright
, but the repo is not available in the default list of repositories. eselect repository enable bright
fails: repository not in repositories.xml
.
Please update the readme to either bring the gentoo instructions up to date or remove the section altogether.
Would be awesome to be able to use something like
$ neofetch > tmatrix
or banner "SAMPLE_TEXT" > tmatrix
and have it display in the way that the -t flag works
I got a total mess, high consumption of CPU. Win11 WSL, distro: Ubuntu
It would be nice if the code lines had a color gradient going from black to bright greenish/white similar to the matrix revolution movie. Here are screenshots from the actual movie: https://imgur.com/a/cXHwLSN
There is a music visualizer that lets people set color steps: https://github.com/dpayne/cli-visualizer
I have no idea if this feature is desired or difficult to implement so its cool if you decide not to do it.
I always thought the matrix reloaded style looked a lot cooler than the original matrix code rain and no one has made an implementation as far as I know.
Edit by @M4444: Creating subtasks:
Fading characters
Rainbow code
Hello TMatrix developers,
I am enjoying using TMatrix and appreciate the work put into it. I am currently trying to set it up in a way that it integrates seamlessly with my transparent terminal setup. I noticed that there is no option to make the background of TMatrix transparent, and I think this feature would be a great addition.
Having the ability to run TMatrix with a transparent background would allow the digital rain effect to overlay beautifully with the desktop wallpaper or other applications, enhancing the visual experience.
Thank you for considering this feature request.
Best regards,
Sergius
This works perfectly fine on my terminal emulator but it seems many characters can't be shown on tty. I know this isn't this program's issue but do you know a way I could add support for those characters?
Running a ubuntu-based system:
sudo ./install.sh
[sudo] Password for user:
install: regular file '/usr/share/zsh/site-functions//_tmatrix' cannot be created: File or directory not found
-> note the //
In install.sh I found
ZSH_COMPLETION_DIR="$INSTALL_PREFIX/share/zsh/site-functions/"
Solved by removing the ending "/" + creating the missing dir ; install runs after these little steps-
The tag v1.3
currently points to an abandoned commit, which causes the Arch Linux build to classify the current version as 1.2. v1.3
should probably be changed to point to master.
I tought it would be cool to create a transparent desktop widget with this effect.
For that I need to > the output to a text file. But if I do I get terminal scaped characters. There is a way to get alphanumeric characters instead on the output?
Thank you.
The rain should adapt to a window resize or at least restart.
Hey I stumbled upon this project after not being satisfied with the accuracy of cmatrix, I just got into linux and back into programming about 5 months ago and I would like to contribute some accurate aesthetic to this projects already extensible and simple code.
My first feature request would be to add a custom font file (to the default if at all possible) that is an exact font image of the one used in the movies. I recognize the amount of work this could be to handle, but in the next couple months I will try to be tackling it head on, making an accurate font image. If I run into any issues It might take a bit seeings how I’m not used to programming in anything but C++, but we will see how this goes.
Most if not all the characters are english/Japanese with mirrored versions every now and then and I feel as if this could be easily done, let me know if you have any ideas or any concerns, Sorry if this sounds a bit weird as this is my first time really using github.
I shall uninstall this unholy abomination. It doesn't work with lolcat!!!
Would be awesome to be able to use something like $ neofetch > tmatrix
or $ banner "SAMPLE_TEXT" > tmatrix
and have it display in the way that the -t flag works
bash
zsh
tcsh
Currently the default value for --steps-per-sec
of 10 looks choppy. But when you set it higher, it also raises the rain falling speed, separately from the -fall-speed
setting.
At 60 steps you cannot even see the characters properly, because they fall so fast, even if you set -f 0,1
.
been getting this when trying to install on rasberry pi, rapsbian os. I know it's running libncurses6.1 not sure if that's the issue, or what needs to be changed so it can find it.
pi@pi:/installation $ sudo ./install.sh/installation $ tmatrix
pi@pi:
-bash: /usr/bin/tmatrix: cannot execute binary file: Exec format error
This is the error when trying to compile from source:
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.13/Modules/FindCurses.cmake:245 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:23 (find_package)
Just do it!
When the rain start a title text should appear in the middle after some short time, similar to how it does in the intro to the movie.
Optionally, users can set their own text.
Hi! I love this digital rain effect. Best one I've ever seen by far. I've been thinking about how it might be possible to turn this into a screensaver somehow?
Has the creator considered this? Anyone have any ideas how this might be accomplished?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.