Created
February 26, 2014 11:11
-
-
Save plexus/9227711 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
# Tea timer | |
Shoes.app do | |
@time = 0 | |
@backgrounds = [] | |
@colors = { | |
white: '#ffffff', | |
green: '#00ff00', | |
red: '#ff0000', | |
} | |
stack do | |
@label = banner '0:00' | |
flow do | |
[2, 15, 30, 60].each do |i| | |
button i.to_s do | |
@time += i | |
end | |
end | |
end | |
end | |
every do | |
puts @time | |
if @time > 0 | |
@time -= 1 | |
@label.text = "%d:%02d" % [@time/60, @time%60] | |
if @time == 0 | |
@backgrounds += [:white, :green, :red, :green, :red] | |
end | |
end | |
unless @backgrounds.empty? | |
background @colors[@backgrounds.pop] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment