18/11/20 13:23:53.49 FaN+D89v.net
>>592 Ruby ターミナル上で10秒間 <marquee>Hello, world</marquee> & 棒がぐるぐる的な感じ
duration = 10
wait = 0.1
str = 'Hello, World!'
len = str.size
bar = %w[- / | \\ ]
clear_lines = -> n {puts "\e[#{n}\e[#{n}A"}
# 非破壊的
str2 = 'Hello, World!' * 2
(duration / wait).round.times{|i|puts str2[i % len, len], bar[i % 4]; sleep(wait); clear_lines[2]}
# 破壊的
hello_ary = 'Hello, World!'.split('')
(duration / wait).round.times{puts hello_ary.rotate!.join, bar.rotate!.first; sleep(wait); clear_lines[2]}