18/11/20 13:50:30.38 +huVy/La.net
訂正
duration = 10
wait = 0.1
str = 'Hello, World!'
bar = %w[- / | \\ ]
clear_lines = -> n {puts "\e[#{n}\e[#{n}A"}
# 破壊的
str_ary = str.split('')
bar_ary = [*bar]
(1..duration / wait).each{puts str_ary.rotate!.join, bar_ary.rotate!.first; sleep(wait); clear_lines[2]}
# 非破壊的
str2 = str * 2
(1..duration / wait).each{|i|puts str2[i % sitr.size, str.size], bar[i % 4]; sleep(wait); clear_lines[2]}