Created
March 1, 2017 13:27
-
-
Save HayatoDoi/05b85bedea09933a0e7f5d1b0d8fbf14 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
#!/usr/bin/env ruby | |
# Terminalに文字をピコピコ出すプログラム | |
# File name : terminal-picopico.rb | |
# Author : Hayato Doi | |
# license : CC0 | |
# | |
# ================================================================= | |
# | |
# @putsSleep() 引数に与えられた文字列を半秒表示して,消す. | |
# | |
# ================================================================= | |
# | |
# Copyright (c) 2017, Hayato Doi | |
MAXSIZE = 40 | |
MESSAGE = "た〜みなるぴこぴこ♪♪" | |
def putsSleep(str) | |
printf str.ljust(MAXSIZE) + "\n" | |
sleep 0.5 | |
printf "\e[#{1}A" | |
STDOUT.flush | |
end | |
while true do | |
(0 .. MESSAGE.size).each do |count| | |
putsSleep MESSAGE[0,count] | |
end | |
putsSleep "" | |
putsSleep MESSAGE | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment