Last active
March 21, 2021 12:45
-
-
Save austintraver/b8f79de7591e103c2d0dd991cb558954 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
counter=0 | |
for row in {2..${LINES}}; do | |
((counter+=1)) | |
# print -f '#'%.s {$((1+1))..$(($COLUMNS-1))}% | |
print -f '#'%.s {1..${COLUMNS}} | |
# (save) (left 1) (erase 1) (col 1) (erase 1) (return) | |
print -N '\x1b7' '\x1b[1D' '\x1b[X' '\x1b[1G' '\x1b[1X' '\x1b8' '\n' | |
done | |
# Erase the first row | |
print -N '\x1b7' '\x1b[1d' '\x1b[2K' '\x1b8' | |
# Erase the last row | |
print -N '\x1b[1A' '\x1b[2K' '\x1b[1B' | |
typeset -i i | |
typeset -i j | |
# Walk the '@' symbol across the first row [left -> right] | |
for (( j=1; j <= ${COLUMNS}; j+=1 )); do | |
print -N '\x1b7' "\x1b[1;${j}H" '\x1b[2K' '@' '\x1b8' | |
sleep 0.01 | |
done | |
# Anchor the symbol to the last column | |
((j=${COLUMNS})) | |
# Walk the '@' symbol along the last column [top -> bottom] | |
for (( i=2; i < ${LINES}; i+=1 )); do | |
# Erase the previous '@' | |
print -N '\x1b7' "\x1b[$((i-1));${j}H" '\x1b[X' '\x1b8' | |
# Create the next '@' | |
print -N '\x1b7' "\x1b[${i};${j}H" '@' '\x1b8' | |
sleep 0.01 | |
done | |
((i=${LINES}-1)) | |
# Walk the '@' symbol along the last row, [right -> left] | |
for (( j=${COLUMNS}-1; j>=0; j-=1 )); do | |
# Erase the previous '@' | |
print -N '\x1b7' "\x1b[${i};$((j+1));H" '\x1b[X' '\x1b8' | |
# Create the next '@' | |
print -N '\x1b7' "\x1b[${i};${j}H" '@' '\x1b8' | |
sleep 0.01; | |
done | |
# Anchor the symbol to the first column | |
((j=1)) | |
# Walk the '@' symbol along the first column [bottom -> top] | |
for (( i=${LINES}-2; i >= 0; i-=1 )); do | |
# Erase the previous '@' | |
print -N '\x1b7' "\x1b[$((i+1));${j}H" '\x1b[X' '\x1b8' | |
# Create the next '@' | |
print -N '\x1b7' "\x1b[${i};${j}H" '@' '\x1b8' | |
sleep 0.01 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some tom-foolery I wrote while procrastinating on an assignment.
This program will print an '@' character to your console, and will use ECMA 48 control functions for coded character sets to make the '@' character circumnavigate your console.