Root
Alpine Spinners

Alpine Spinners

Here are all the Alpine spinners, animated:

How Alpine spinners were obtained

Alpine spinners are coded in the source file alpine/busy.c:

 63 } spinners[] = {
 64     {4, 4, {"<|> ", " ", "<-> ", "<\\> "}},
 65     {11, 4, {"--|-(o)-|--", "--/-(o)-\\--", "----(o)----", "--\\-(o)-/--"}},
 66     {6, 7, {"\\____/", "_\\__/_", "__\\/__", "__/\\__",
 67             "_/__\\_", "/____\\", "|____|"}},
 68     {4, 4, {"<|> ", "<\\> ", "<-> ", " "}},
 ...

Each spinner is defined as a series of fixed-width strings displayed as frames in an animation. I've taken these spinners out of the source, and written a Python script to produce a shell script to produce GIF animations of each spinner with the help of ImageMagick.

The spinners, reduced to a simple syntax, spinners.txt:

"<|> "" ""<-> ""<\\> "
"--|-(o)-|--""--/-(o)-\\--""----(o)----""--\\-(o)-/--"
"\\____/""_\\__/_""__\\/__""__/\\__""_/__\\_""/____\\""|____|"
"<|> ""<\\> ""<-> "" "
...

The Python script, spinners.py:

import re

f = open("spinners.txt")

i = 0
for l in f.readlines():
  l = l.strip()
  m = re.findall('"([^"]+)"', l)
  frame = 0 
  for item in m:
    name = "spinner-%02d-%02d.png" % (i, frame)
    cmd = """convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working %s ]'" %s""" % (item, name)
    print cmd
    frame += 1
  print "echo spinner-%02d.gif" % i
  print "convert -delay 10 -loop 0 spinner-%02d-*.png spinner-%02d.gif" % (i, i)
  print "rm spinner-%02d-*.png" % i
  i += 1

f.close()

An example output:

convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working <|>  ]'" spinner-00-00.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working </>  ]'" spinner-00-01.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working <->  ]'" spinner-00-02.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working <\\>  ]'" spinner-00-03.png
echo spinner-00.gif
convert -delay 10 -loop 0 spinner-00-*.png spinner-00.gif
rm spinner-00-*.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working --|-(o)-|-- ]'" spinner-01-00.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working --/-(o)-\\-- ]'" spinner-01-01.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working ----(o)---- ]'" spinner-01-02.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working --\\-(o)-/-- ]'" spinner-01-03.png
echo spinner-01.gif
convert -delay 10 -loop 0 spinner-01-*.png spinner-01.gif
rm spinner-01-*.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working \\____/ ]'" spinner-02-00.png
convert -size 200x20 xc:black -fill white -font "DejaVu-Sans-Mono-Bold" -draw "text  8,16 '[Working _\\__/_ ]'" spinner-02-01.png
...

The script can be run with python spinners.py | sh -e.


This is http://michal.guerquin.com/alpine-spinners.html, updated 2008-11-10 01:53 EST

Contact: michalg at domain where domain is gmail.com (more)