RubyのShoesでGUIプログラミング

おもしろい。

Shoes.app do
   flow margin: 12 do
     # Set up three buttons                                                        
     @one = button "One"
     @two = button "Two"
     @three = button "Three"
     # Bounce the second button                                                    
     @one.click do |button|
       alert "You are No.1!"
     end
     @two.click do |button|
       alert "Thunderbird 2!"
     end
     @three.click do |button|
       alert "The 3rd impact!"
     end
     animate do |i|
       @one.displace(0, (Math.sin(i) * 6).to_i)
       @two.displace(0, (Math.sin(i+PI/2.0) * 6).to_i)
       @three.displace(0, (Math.sin(i+PI) * 6).to_i)
     end
   end
 end