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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment