-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a9dc59
commit dfea4b2
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
# --- Animation Frames --- | ||
frames=( | ||
" | ||
_,-._ | ||
/ \_/ \ | ||
>-(_)-< | ||
\_/ \_/ | ||
`-' | ||
" | ||
" | ||
_,-._ | ||
/ \_/ \ | ||
>-(_)-< | ||
\_/ \_/ | ||
`-' | ||
" | ||
" | ||
_,-._ | ||
/ \_/ \ | ||
>-(_)-< | ||
\_/ \_/ | ||
`-' | ||
" | ||
" | ||
_,-._ | ||
/ \_/ \ | ||
>-(_)-< | ||
\_/ \_/ | ||
`-' | ||
" | ||
) | ||
# --- Animation Speed --- | ||
delay=0.1 # Seconds between frames | ||
# --- Function to Display Animation --- | ||
animate() { | ||
local frame_count=${#frames[@]} | ||
local i=0 | ||
while true; do | ||
clear | ||
echo "${frames[$i]}" | ||
sleep "$delay" | ||
((i = (i + 1) % frame_count)) # Cycle through frames | ||
done | ||
} | ||
# --- Main Script --- | ||
# Check for Ctrl+C (SIGINT) and exit cleanly | ||
trap "clear; exit 0" SIGINT | ||
animate & # Run animation in the background | ||
pid=$! # Get process ID of the animation | ||
# Simulate other parts of your script here: | ||
sleep 5 # Animation runs for 5 seconds | ||
# --- Stop Animation and Exit --- | ||
kill "$pid" # Stop the animation process | ||
wait "$pid" # Wait for the animation process to finish | ||
clear | ||
echo "Animation stopped." | ||
exit 0 |
Binary file not shown.