Created
May 16, 2016 22:33
-
-
Save maxjacobson/fe40c331b4046e348376bf565ca6eee3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trap('INT') do | |
print("\n") | |
exit | |
end | |
output = Enumerator.new do |yielder| | |
chars = "▁▂▃▄▅▆█".split("") | |
chars = chars + chars.reverse | |
nums = (0..(chars.length - 1)).to_a | |
loop do | |
char = chars.fetch(nums.first) | |
yielder << char | |
nums.rotate! | |
end | |
end | |
loop do | |
print output.next | |
sleep 0.1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment