Skip to content

Instantly share code, notes, and snippets.

@danyalette
Last active February 15, 2019 11:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danyalette/314e47a458506868439e308e1d9e4e09 to your computer and use it in GitHub Desktop.
Save danyalette/314e47a458506868439e308e1d9e4e09 to your computer and use it in GitHub Desktop.
bash function to print an ascii animation. takes a directory as an argument. prints the contents of each file in the directory, in sequence.
#!/bin/bash
# hash bang bin bash!
function ascii_anim() {
if [[ $# -eq 0 ]] ; then
echo 'Please specify a directory.'
return
fi
DIR=$1
SLEEP=0.1;
TLINES=$(wc -l < $(find $DIR -type f | head -n 1))
FILES=$DIR/*
for f in $FILES
do
tput cub $COLUMNS
cat $f
sleep $SLEEP
tput cuu $TLINES
done
tput cud $TLINES
echo ""
}
@danyalette
Copy link
Author

danyalette commented Sep 22, 2016

giphy

The frames are as follows:

~/ascii_danya/frame1.txt

 ________________________________________
(________________________________________)
(_________________________________________)
(_________________________________________)
(_________________________________________)
(_________________________________________)

~/ascii_danya/frame2.txt

 _____    _________     __________  _____
(_____)  (_________)   (__________)(_____)
(______)(___________)_ (_________)(_______)
(______)(_____________)(_______)  (_______)
(______)(______________________)  (_______)
(_____) (______________________)  (_______)

~/ascii_danya/frame3.txt

 _____    _____   _     __________  _____
(_____)  (_____) (_)   (__________)(_____)
(______)(_______)(__)_ (_________)(_______)
(______)(_______)(_)(_)(_______)  (_______)
(______)(_______)(_)  (________)  (_)   (_)
(_____) (_______)(_)   (_______)  (_)   (_)

~/ascii_danya/frame4.txt

 _____    _____   _     ____     _  _____
(_____)  (_____) (_)   (____)   (_)(_____)
(_)  (_)(_)___(_)(__)_ (_____)_(_)(_)___(_)
(_)  (_)(_______)(_)(_)(_______)  (_______)
(_)__(_)(_______)(_)  (________)  (_)   (_)
(_____) (_______)(_)   (_______)  (_)   (_)

~/ascii_danya/frame5.txt

 _____    _____   _     _  _     _  _____
(_____)  (_____) (_)   (_)(_)   (_)(_____)
(_)  (_)(_)___(_)(__)_ (_) (_)_(_)(_)___(_)
(_)  (_)(_______)(_)(_)(_)   (_)  (_______)
(_)__(_)(_)   (_)(_)  (__)   (_)  (_)   (_)
(_____) (_)   (_)(_)   (_)   (_)  (_)   (_)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment