#!/bin/bash # BR-Donut - Spinning donut (inspired by donut.c) clear trap 'printf "\033[?25h\033[0m"; clear; exit' INT TERM EXIT printf '\033[?25l' COLS=$(tput cols) LINES=$(tput lines) W=$((COLS > 80 ? 80 : COLS)) H=$((LINES > 24 ? 24 : LINES - 2)) A=0 while true; do output="" declare -a buf zbuf for ((i=0;i/dev/null) Y=$(echo "scale=0; $H/2 + $H/3 * $D * ($CI * $H2 * $SA + $SJ * $CA)" | bc 2>/dev/null) if [[ -n "$X" && -n "$Y" ]] && (( X >= 0 && X < W && Y >= 0 && Y < H )); then L=$(echo "scale=0; 8 * ($SJ * $SA - $SI * $CJ * $CA) * $D" | bc 2>/dev/null) (( L < 0 )) && L=0 IDX=$((Y*W+X)) DINT=$(echo "scale=0; $D * 10000" | bc 2>/dev/null) if (( DINT > zbuf[IDX] )); then zbuf[$IDX]=$DINT CHARS=".,-~:;=!*#$@" (( L > 11 )) && L=11 (( L < 0 )) && L=0 buf[$IDX]=${CHARS:$L:1} fi fi i=$((i+40)) done j=$((j+40)) done printf '\033[H\033[38;5;205m' for ((y=0;y