ターミナルにマトリックスっぽく文字を落としたり、雪を降らせたりするスクリプト
unimatrix
, snowmachine
というターミナルで文字を落とすスクリプトがあったので試してみる。両方ともPythonで書かれているのでPythonで同様なことをしたいときは参考になるかも。
unimatrix
unimatrix
は映画「マトリックス」のようにターミナルに文字を落とすことができるスクリプト。CMatrixという同様なツールをベースにしているとのこと。
インストール
スクリプトをダウンロードして実行権限を付ければよい。
$ curl -L https://raw.githubusercontent.com/will8211/unimatrix/master/unimatrix.py -o unimatrix $ chmod +x unimatrix
pip
でもインストールできる。
$ pip install git+https://github.com/will8211/unimatrix.git
使い方
オプションを指定せずに実行できるが、以下のように色や落とす文字列を指定することもできる(終了はCtrl-c
)。
$ unimatrix -c blue -u 'Linux'
また、ヘルプに記述があるが実行中に矢印キーでスピードを変えたり、数字キーで色を変えたりすることもできる。
KEYBOARD CONTROL SPACE, CTRL-c or q exit - or LEFT decrease speed by 1 + or RIGHT increase speed by 1 [ or DOWN decrease speed by 10 ] or UP increase speed by 10 a toggle asynchronous scrolling b cycle through bold character options (bold off-->bold on-->all bold) f toggle flashing characters o toggle on-screen status 1 to 9 set color: (1) Green (2) Red (3) Blue (4) White (5) Yellow (6) Cyan (7) Magenta (8) Black (9) Terminal default ! to ( set background color (same colors as above, but pressing shift + number)
snowmachine
snowmachine
はターミナルに雪を降らせるツール。
インストール
pip
でインストールできる。
$ pip install snowmachine
ヘルプ情報。
$ snowmachine --help Usage: snowmachine [OPTIONS] Options: --speed INTEGER Increase to make it snow faster. --stack TEXT Make the snow stack. --particle TEXT Change the partice used. Could be used to make it rain. --help Show this message and exit.
使い方
snowmachine
コマンドを実行してCtrl-c
で終了する。
--stack TEXT
オプションを指定すると雪を積もらせることができる。