Created
May 30, 2014 00:15
-
-
Save germanrdz/8292ddf5003d9b074805 to your computer and use it in GitHub Desktop.
This file contains 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
class App | |
class << self | |
def animate(frames, seconds) | |
frame = 0; | |
advance = 1; | |
frames_per_second = frames.size * 2; | |
total_frames = frames_per_second * seconds; | |
total_frames.times do | |
puts "\e[H\e[2J" # clears the screen | |
puts frames[frame] | |
frame += advance; | |
advance *= -1 if frame == 0 or frame == frames.size - 1; | |
sleep(1.0/(frames.size*2.0)) | |
end | |
end | |
def run | |
animation = [ "8m===D", "8=m==D", "8==m=D", "8===mD" ] | |
ending = [ "8m===Do", "8=m==D~o", "8==m=D ~o", "8===mD" ] | |
animate(animation, 4) | |
animate(ending, 2) | |
end | |
end | |
end | |
App.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment