Created
February 24, 2025 16:26
-
-
Save lynsei/11d4fd46e22306f5c365401ae0cd872c to your computer and use it in GitHub Desktop.
[Spinners] #spinners
This file contains hidden or 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
# Spinners | |
Perl Spinner/Heartbeat demonstrator (Unicode complaint) | |
perl -CO -Mutf8 -e '$|=1; $c=" ▏▎▍▌▋▊▉█"; | |
while(1){ for $i ($c=~/(.)/g) { | |
print " $i\r"; select(undef,undef,undef,.1+1/length($c)); } };' | |
Python version | |
=======8<-------- | |
import time; | |
while True: | |
for i in "-≻›⟩|⟨‹≺": | |
print(" "+i+"\r", end="") | |
time.sleep(.1) | |
=======8<-------- | |
If there are many choices for a Unicode character in a Spinner, it is often | |
best to select as many characters from the same Unicode block for best glyph | |
similarities in different fonts. | |
A Reference for Unicode characters | |
https://antofthy.gitlab.io/info/data/utf8_demo.txt | |
Shell usage example (not Unicode compliant)... | |
=======8<-------- | |
spinner='-\|/'; | |
spinlen=${#spinner} | |
timeout=30 # timeout in seconds | |
printf -v start '%(%s)T' -1 # save the start time | |
while true; do | |
# wait for some condition | |
# if finished... | |
# printf "Condition has been met\r" # success, and clean wait line | |
# break | |
# fi | |
# Timeout check | |
printf -v elapsed '%(%s)T' -1 # current time | |
elapsed=$(( elapsed - start )) # elapsed time | |
if (( elapsed > timeout )); then | |
echo "Timeout waiting for condition" # timeout, and clean wait line | |
break | |
fi | |
# Wait line with spinner... | |
char=$(( (char+1)%spinlen )) | |
printf "Waiting... %c %d sec\r" "${spinner:$char:1}" $elapsed | |
sleep .2 # loop sleep, minimum spin rate | |
done | |
=======8<-------- | |
------------------------------------------------------------------------------- | |
ASCII Spinner/Heartbeat Character Sequences | |
Replace each character with next, in a loop | |
A patrol is the same sequence going forward then reverse | |
Spinning Line "-\|/" (for coding use... "-\\|/") | |
(This was made famous by Sun Workstations Boot sequence) | |
Pulsing Circle: ".oOo" | |
Balloon: " .oO@*" | |
Flip line: "__\|/__" (for coding "__\\|/__") | |
Flip line (patrol): "__\|/____/|\__" (for coding "__\\|/____/|\\__") | |
Pacman Muncher: "->|>-" | |
Folding Over: "-<|>-" patrol: "->|<--<|>-" | |
Bat and Ball: "dqpb" | |
------------------------------------------------------------------------------- | |
Unicode Spinner/Heartbeat Character Sequences | |
Unicode Spinning Line "─╲│╱" Better to use ASCII version! | |
Flip Line: "_-`'´-_" I think it could be better! | |
Pacman Muncher: "-≻›⟩›≻-" | |
Pacman Muncher (right): "-≺‹⟨‹≺-" | |
Folding Over (left-right): "-≻›⟩|⟨‹≺" | |
Folding Over (right-left): "-≺‹⟨|⟩›≻" | |
Folding Over (patrol): "-≻›⟩|⟨‹≺-≺‹⟨|⟩›≻" | |
Quarter Circle Spinner: "◟◜◝◞" | |
Extended Circle Spinner: "◜◠◝◞◡◟" | |
Corner Circle Spinner: "◴◷◶◵" | |
Half Circle Spinner: "◐◓◑◒" small in some fonts | |
Half Circle Flip: "◡⊙◠⊙" | |
Ellipses: " ․‥…" not very visible | |
Circle Tail b: "bᓂqᓄ" not in xterm fonts | |
Circle Tail d: "dᓇpᓀ" | |
Rain Circle: " ⋅∘○⨀" | |
Pulsing Circle "◌○⊙●⊙○" | |
Pulsing Dot: "⋅∙●∙" | |
Pulsing Heart: "⋅•❤•⋅⋅⋅" | |
Pulsing Line: "❘❙❚❙" | |
Pulsing Line Heart: "❘❙❚❤❚❙❘" depends on font | |
Pulsing Square: "▪◼█◼▪" | |
Pulsing Square 2: "▪■□▫" | |
Corners: "⌞⌜⌝⌟" | |
Large Corners: "⎿⎾⏋⏌" | |
Corner Box: "◰◳◲◱" | |
Triangle: "◣◤◥◢" | |
Triangle Pulse: "▫◸◤◸▫◹◥◹▫◿◢◿▫◺◣◺" | |
Triangle Pulse 2: "■◤◸◤■◥◹◥■◢◿◢■◣◺◣" | |
Moving Horizontal Bar: "⎽⎼―⎻⎺ " patrol: "⎽⎼―⎻⎺⎻―⎼" | |
Moving Vertical Bar: "▏⎢⎪⎥▕ " patrol: "▏⎢⎪⎥▕⎥⎪⎢" | |
Tone Bar: "˩˨˧˦˥" patrol: "˩˨˧˦˥˦˧˨" | |
Rising Vertical Bar: "ˌ╷❘ﺍ╵ˈ" | |
Growth & Decay: "․|†¥∨⌄" | |
Pulsing Star: "⋅˖+⟡✧⟡+˖" | |
Pulsing Plus: "⋅˖+┼╋┼+˖" | |
Bouncing Bubble: "'°º¤ø,¸¸,ø¤º°'" | |
Mathematical Equals: "−=≡" | |
Mathematical Compares: "≑≒≑≓" | |
I-Ching: "☱☲☴" | |
Arrow: "←↖↑↗→↘↓↙" | |
Dingbat Arrow: "➵➴➵➶" | |
Dibbat Bold Arrows: "➸➷➸➹" | |
-- | |
Pulsing (two character)... | |
Squish: "╫╪" | |
Toggle Line: "⊶⊷" | |
Toggle Sm Box: "▫▪" | |
Toggle Lg Box: "□■" | |
Toggle Shogi "☖☗" | |
--- | |
Box Graphic Glyphs... | |
Noise Fading: "█▓▒░ " | |
Quarter Block Spinner: "▘▝▗▖" | |
Half Block Spinner: "▄▌▀▐" | |
Quarter Block Worm: "▘▀▝▐▗▄▖▌" | |
Diagonally Moving Block: " ▖◼▝ ▗◼▘" | |
Box Bar Horizontal: " ▏▎▍▌▋▊▉█" patrol: " ▏▎▍▌▋▊▉█▉▊▋▌▍▎▏" | |
Box Bar Vertical: " ▁▂▃▄▅▆▇█" patrol: " ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁" | |
(with some reverse video these can be made fancier) | |
--- | |
Half Lane Glyphs... | |
Half Line Spinner: "╷╴╵╶" | |
Half Line Spinner Bold: "╻╸╹╺" | |
Half Line Spinner Pulsed: "╷╴╹╶" | |
Pulsing Half Line Spinner: "╷╴╵╶╻╸╹╺" | |
Moving Line: "╴━╶ " | |
Rotating Moving Line: "╴━╶╷┃╵╶━╴╵┃╷" | |
Wind-shield Wiper Patrol: "╷╴╵╶╷╷╷╶╵╴╷╷" | |
Pipe Spinner: "┤┘┴└├┌┬┐" | |
Pipe Spinner Bold: "┫┛┻┗┣┏┳┓" | |
Pipe Spinner Mixed: "┤┙┚┴┖┕├┍┎┬┒┑" | |
Two Handed Clock (16): "╹┖╿┚┕╺┍╼╽┎╻┒┙╾┑╸" | |
Two Handed Cycle (20): "╹┖╿┚╹╺┍╼┕╺╻┒╽┎╻╸┙╾┑╸" | |
--- | |
Braille Glyphs... | |
NOTE: Braille Glyphs work well as spinners, but the glyphs are not good when | |
used with most True Type fonts as 'Braille Space', ('⠀') is not blank, but a | |
set of empty circles, making the use of them, even for braille readers, | |
problematical! It was simply a bad design choice by font foundaries. | |
Braille Circling Dot: "⡀⠄⠂⠁⠈⠐⠠⢀" | |
Braille Circling Dot Db: "⣀⡄⠆⠃⠉⠘⠰⢠" | |
Braille Circling Hole: "⢿⣻⣽⣾⣷⣯⣟⡿" | |
Braille Circling Hole Db: "⣶⣧⣏⡟⠿⢻⣹⣼" | |
Braille Twin Circling Dots: "⡈⠔⠢⢁" | |
Braille Leapfrog: "⣀⢄⢂⢁⡈⡐⡠" | |
Braille Bouncing Dot: "⡀⠄⠂⠁⠁⠂⠄" right-side: "⢀⠠⠐⠈⠈⠐⠠" | |
Braille Bounce Side-Side: "⡀⠄⠂⠁⠈⠐⠠⢀⠠⠐⠈⠁⠂⠄" | |
Braille Bouncing Ball: "⣤⠶⠛⠛⠶" | |
Braille Climber: "⣀⡠⠤⠢⠒⠊⠉⠑⠒⠔⠤⢄" | |
Braille Coveyer Belt: "⢸⣸⢼⢺⢹⡏⡗⡧⣇⡇" | |
Braille Up-Down Belt: "⢸⣸⢼⢺⢹⢺⢼⣸⢸⡇⣇⡧⡗⡏⡗⡧⣇⡇" | |
Falling Sand (35): "⠁⠂⠄⡀⡈⡐⡠⣀⣁⣂⣄⣌⣔⣤⣥⣦⣮⣶⣷⣿⡿⠿⢟⠟⡛⠛⠫⢋⠋⠍⡉⠉⠑⠡⢁" | |
___Braille 6 dot___ | |
Braille 6 Circle Worm: "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏" | |
Braille 6 Bounce Worm: "⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆" | |
Braille Zigzag Worm: "⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓" | |
Braille Zigzag Stop: "⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓" | |
Braille 6 Step Left (24): "⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁" | |
Braille 6 Step Right (24): "⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈" | |
Braille 6 Step Both (30): "⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈⠉" | |
Braille Two Dot Clock (top 36): "⠈⠘⠨⠌⠊⠉⠘⠐⠰⠔⠒⠑⠨⠰⠠⠤⠢⠡⠌⠔⠤⠠⠆⠅⠊⠒⠢⠆⠂⠃⠉⠑⠡⠅⠃⠁" | |
Braille Two Dot Clock (left 36): "⠂⠃⠊⠒⠢⠆⠃⠁⠉⠑⠡⠅⠊⠉⠈⠘⠨⠌⠒⠑⠘⠐⠰⠔⠢⠡⠨⠰⠠⠤⠆⠅⠌⠔⠤⠄" | |
Braille Two Dot Cycle (42): "⠂⠃⠊⠒⠢⠆⠂⠁⠉⠑⠡⠅⠃⠁⠈⠘⠨⠌⠊⠉⠈⠐⠰⠔⠒⠑⠘⠐⠠⠤⠢⠡⠨⠰⠠⠄⠆⠅⠌⠔⠤⠄" | |
___Braille 8 dot___ | |
Braille Circle Worm: "⠋⠙⠹⠸⢰⣰⣠⣄⣆⡆⠇⠏" | |
Braille Bounce Worm: "⡀⡄⡆⠇⠋⠙⠸⢰⢠⢀⢠⢰⠸⠙⠋⠇⡆⡄" | |
Braille Worm Uturn: "⠋⠙⠹⠸⢰⣰⣠⣄⣆⡆⡖⠖⠚⠙⠋⠏⠇⡆⣆⣄⣠⣰⢰⢲⠲" | |
Braille Step Left (36): "⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⢤⣠⣀⢀⢀⣀⣠⢤⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁" | |
Braille Step Right (36): "⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⡤⣄⣀⢀⢀⣀⣄⡤⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈" | |
Braille Step Both (40): "⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⢤⣠⡀⡀⣀⢀⢀⣄⡤⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈⠉" | |
Braille Stacking (40): "⠀⡀⠄⠂⠁⠈⠐⠠⢀⣀⢄⢂⢁⢈⢐⢠⣠⢤⢢⢡⢨⢰⣰⢴⢲⢱⢸⣸⢼⢺⢹⣹⢽⢻⣻⢿⣿⣶⣤⣀" | |
Braille Two Dot Clock (top, 64): | |
"⠈⠘⠨⢈⡈⠌⠊⠉⠘⠐⠰⢐⡐⠔⠒⠑⠨⠰⠠⢠⡠⠤⠢⠡⢈⢐⢠⢀⣀⢄⢂⢁⡈⡐⡠⣀⡀⡄⡂⡁⠌⠔⠤⢄⡄⠠⠆⠅⠊⠒⠢⢂⡂⠆⠂⠃⠉⠑⠡⢁⡁⠅⠃⠁" | |
Braille Two Dot Clock (left, 64): | |
"⠂⠃⠊⠒⠢⢂⡂⠆⠃⠁⠉⠑⠡⢁⡁⠅⠊⠉⠈⠘⠨⢈⡈⠌⠒⠑⠘⠐⠰⢐⡐⠔⠢⠡⠨⠰⠠⢠⡠⠤⢂⢁⢈⢐⢠⢀⣀⢄⡂⡁⡈⡐⡠⣀⡀⡄⠆⠅⠌⠔⠤⢄⡄⠄" | |
Braille Two Dot Cycle (72): | |
"⠂⠃⠊⠒⠢⢂⡂⠆⠂⠁⠉⠑⠡⢁⡁⠅⠃⠁⠈⠘⠨⢈⡈⠌⠊⠉⠈⠐⠰⢐⡐⠔⠒⠑⠘⠐⠠⢠⡠⠤⠢⠡⠨⠰⠠⢀⣀⢄⢂⢁⢈⢐⢠⢀⡀⡄⡂⡁⡈⡐⡠⣀⡀⠄⠆⠅⠌⠔⠤⢄⡄⠄" | |
------------------------------------------------------------------------------- | |
Emoji Spinners... | |
Circle Lines: "㊀㊁㊂" | |
Hour Clock: "🕛🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚" | |
Earth: "🌍🌎🌏" | |
Moon Phases: "🌑🌒🌓🌔🌕🌖🌗🌘" | |
Runner: "🚶🏃" | |
Speaker: "🔈🔉🔊🔉" | |
------------------------------------------------------------------------------- | |
Special 2 Character, Braille "Circling Dots" Loading Sequence... | |
perl -CO -Mutf8 -e '$|=1; | |
$c="⢀⠀⡀⠀⠄⠀⢂⠀⡂⠀⠅⠀⢃⠀⡃⠀⠍⠀⢋⠀⡋⠀⠍⠁⢋⠁⡋⠁⠍⠉⠋⠉⠋⠉"; | |
$c.="⠉⠙⠉⠙⠉⠩⠈⢙⠈⡙⢈⠩⡀⢙⠄⡙⢂⠩⡂⢘⠅⡘⢃⠨⡃⢐⠍⡐⢋⠠⡋⢀⠍⡁⢋⠁⡋⠁⠍⠉⠋⠉⠋⠉"; | |
$c.="⠉⠙⠉⠙⠉⠩⠈⢙⠈⡙⠈⠩⠀⢙⠀⡙⠀⠩⠀⢘⠀⡘⠀⠨⠀⢐⠀⡐⠀⠠⠀⢀⠀⡀"; | |
while(1){ for $i ($c=~/(..)/g) { | |
print " $i\r"; select(undef,undef,undef,.2); } };' | |
------------------------------------------------------------------------------- | |
Line Sequences | |
Sonar | |
" . " | |
" o " | |
" (O) " | |
" (( )) " | |
" ((( ))) " | |
"((( )))" | |
"(( ))" | |
"( )" | |
" " | |
Scrolling arrows and bouncing balls are straight forward to implement. | |
The individual characters interchangeable, so I only represent a example frame. | |
They are all reversable and you can mix and match as needed. | |
"▐ ⋅ ▌" | |
"| • |" | |
"( ● )" | |
" ──▷ " | |
" ══➤ " | |
" ──➤ " | |
" ⋅•● " | |
" ⸫⸪>=- " | |
"▹▸▹▹▹" | |
"▰▰▰▱▱▱▱▱▱" | |
" ● " | |
"▐⠀⠀⠁⠂⠄⡀⠄⠀⠀▌" Bouncing like a game "Pong" (bad with true type fonts) | |
"______|\___" Shark fin swiming back and forth | |
Braille dots falling into a stack (tetris-like) | |
Quite complex to implement, but would be a interesting exercise. | |
"⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⣺" | |
Also see Bar Graphing, next... | |
------------------------------------------------------------------------------- | |
Prograss Bars, and Bar Chart... | |
These are not spinners, but used for generating horizontal bar graphs. | |
Or for reporting actual progress of a task that has a known 'end'. | |
See Unicode percent script | |
https://antofthy.gitlab.io/software/#percent_utf | |
Single Char "-" "=" "#" "▒" (single character graphs) | |
ASCII Seq "-=#" (not great) | |
Hash Chars "░▒▓█" | |
Half Chars "▌█", | |
Quarter chars "▖▌▛█" | |
Incremental "▏▎▍▌▋▊▉█" <--- the ideal 8 character increment bargraph | |
Braille chars "⡀⡄⡆⡇⣇⣧⣷⣿" braille character in 8 increments (quite good) | |
The 'Incremental' is ideal with 8 increments per characters. | |
As such in a 50 character percentage bar, each increment represents a ¼% | |
On the other hand using 'Half Chars' over a 50 char length is 1% per increment. | |
------------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment