You are not logged in.
Here's another coding byproduct. I somehow ended up playing with terminal colors, wrote some Perl code to convert terminal colors to hexadecimal values and vice versa (I might post that later too), played with some ascii art in the terminal, then wrote this just for fun.
The color transitions correspond to random single steps within the 6x6x6 color cube of a 256-color terminal.
There are currently 3 modes:
mode 1
cascade_colors
Full lines of color.
mode 2
cascade_colors 1 x
Symmetric margins that vary randomly by steps of x.
mode 3
cascade_colors 2 x y
A wandering stream of width x that moves by steps of y. Try this with "cascade_colors 2 15 15" in a full-screen terminal. *edit* Try "15 10" too.
The code should be easy to tweak. If you come up with some interesting modes, post them.
function cascade_colors()
{
_I=1
_J=0
_K=0
_WIDTH=$COLUMNS
_MARGIN=0
while true; do
_A=$(($RANDOM % 3))
_B=$(($RANDOM % 2))
_C=$(($RANDOM % 3))
case $_A in
0)
case $_B in
0)
[ $_I -gt 1 ] && _I=$(($_I - 1))
;;
1)
[ $_I -lt 6 ] && _I=$(($_I + 1))
;;
esac
;;
1)
case $_B in
0)
[ $_J -gt 0 ] && _J=$(($_J - 1))
;;
1)
[ $_J -lt 5 ] && _J=$(($_J + 1))
;;
esac
;;
2)
case $_B in
0)
[ $_K -gt 0 ] && _K=$(($_K - 1))
;;
1)
[ $_K -lt 5 ] && _K=$(($_K + 1))
;;
esac
;;
esac
case $1 in
1)
_DELTA=$2
case $_C in
0)
[ $_WIDTH -lt $(($COLUMNS - 2*$_DELTA)) ] && _WIDTH=$(($_WIDTH + 2*$_DELTA))
;;
1)
[ $_WIDTH -gt $((1 + 2*$_DELTA)) ] && _WIDTH=$(($_WIDTH - 2*$_DELTA))
;;
esac
_MARGIN=$((($COLUMNS-$_WIDTH)/2))
;;
2)
_WIDTH=$2
_DELTA=$3
case $_C in
0)
[ $_MARGIN -le $(($COLUMNS - $_WIDTH - $_DELTA)) ] && _MARGIN=$(($_MARGIN + $_DELTA))
;;
1)
[ $_MARGIN -ge $_DELTA ] && _MARGIN=$(($_MARGIN - $_DELTA))
;;
esac
;;
*)
_WIDTH=$COLUMNS
_MARGIN=0
;;
esac
_NUMBER=$((15 + $_I + 6*$_J + 36*$_K))
echo -en "\e[0;49m"
if [ $_MARGIN -gt 0 ]; then
for _FOO in $(seq $_MARGIN); do
echo -en " "
done
fi
printf "\e[0;48;5;${_NUMBER}m"
for _FOO in $(seq $_WIDTH); do
echo -en " "
done
echo -e "\e[0;49m"
done
}
*edit*
Stop it with ^C. Feel free to add some other way to stop it (timer, external condition, etc)
Last edited by Xyne (2010-06-07 02:14:29)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Wow, wonderful work again Xyne! I've seen something like this before, but it was a lot more seizure-y (it only had full lines of color) while yours is a lot more screen-saver-y (2 15 10 is really sweet). Is there any way to actually set this as a screen saver?
Last edited by jac (2009-12-24 10:04:18)
Offline
Thanks for the feedback.
There's probably some way to invoke it after a set amount of time but I have no idea how.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline