Skip to content

Instantly share code, notes, and snippets.

@asika32764
Forked from ellemenno/spinner.rb
Created June 24, 2016 01:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asika32764/19956edcc5e893b2cbe3768e91590cf1 to your computer and use it in GitHub Desktop.
Save asika32764/19956edcc5e893b2cbe3768e91590cf1 to your computer and use it in GitHub Desktop.
ascii spinner
#!/usr/bin/env ruby
# encoding: UTF-8
@dot_cycle = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']
#braille random: 0x2800 - 0x28ff
@z_arrow = ['←','↖','↑','↗','→','↘','↓','↙']
@z_b = ['b','ᓂ','q','ᓄ']
@z_d = ['d','ᓇ','p','ᓀ']
@z_bar = ['|','/','—','\\']
@z_x = ['x','+']
@z_1 = ['◰','◳','◲','◱']
@z_2 = ['◴','◷','◶','◵']
@z_3 = ['◐','◓','◑','◒']
@y_d = ['d','|','b','|']
@y_q = ['q','|','p','|']
@x_b = ['ᓂ','—','ᓄ','—']
@x_d = ['ᓇ','—','ᓀ','—']
@grow_a = ['|','b','O','b']
@grow_b = ['_','o','O','o']
@grow_c = ['.','o','O','@','*',' ']
@grow_d = ['▁','▃','▄','▅','▆','▇','█','▇','▆','▅','▄','▃']
@grow_e = ['▉','▊','▋','▌','▍','▎','▏','▎','▍','▌','▋','▊','▉']
def spin(seq, sec=0.2)
i = 0
n = seq.length
loop do
print seq[i]
i = (i + 1) % n
sleep sec;
print "\r"
end
end
begin
spin(@grow_c)
rescue Exception => e
print "\nbye!"
end
exit
@antofthy
Copy link

antofthy commented Jul 8, 2020

You may like to look at
https://antofthy.gitlab.io/info/ascii/HeartBeats_howto.txt

Of course many work better with a X window font that GTK terminal or Monospace font.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment