Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (28 sloc) 0.928 kB

Show and hide the slots

At first, preparing all slots hided in piles. Then do show or hide them at the right moment. It works as like using url method.

Original idea was given by Michael Kohl.

# sample66.rb
Shoes.app :width => 200, :height => 200 do
  background tan
  st = {:left => 10, :top => 10, :width => 180, :height => 180}

  slots = []
  10.times do |i|
    slots << stack do
      color = COLORS.keys[rand(COLORS.keys.length)]
      background COLORS[color], :curve => 20
      para i
      para color.to_s
    end.hide
  end

  slots.each{|s| s.style st}

  every 1 do |i|
    hit = slots[i%10]
    slots.each{|s| s == hit ? s.show : s.hide} 
  end
end

sample66.png

sample66.png

Policeman

The sample66.rb worked well with Shoes-0.r1263

Jump to Line
Something went wrong with that request. Please try again.