Sha256: ae812f9c35711180c6ccdc59615cf616a0679da7e3e8fa14e42cae9a0a4350e4

Contents?: true

Size: 1011 Bytes

Versions: 12

Compression:

Stored size: 1011 Bytes

Contents

class MenuPanel < Shoes::Widget
  $boxes = []
  def initialize(color, args)
    $boxes << self
    background color
    para link("Box #{$boxes.length}", :stroke => white, :fill => nil).
      click { visit "/" },
        :margin => 18, :align => "center", :size => 20
    yield
  end
end

Shoes.app :width => 600, :height => 130 do
  style(Link, :underline => nil)
  style(LinkHover, :fill => nil, :underline => nil)
  
  expand = proc do
    hover do |box|
      if box.width < 170
        a = animate 30 do
          $boxes.each do |b|
            b.width -= 5 if b != box and b.width > 140
          end
          box.width += 5
          a.stop if box.width >= 170
        end
      end
    end
  end
    
  menu_panel green,  :width => 170, :height => 120, :margin => 4, &expand
  menu_panel blue,   :width => 140, :height => 120, :margin => 4, &expand
  menu_panel red,    :width => 140, :height => 120, :margin => 4, &expand
  menu_panel purple, :width => 140, :height => 120, :margin => 4, &expand
end

Version data entries

12 entries across 9 versions & 4 rubygems

Version Path
scarpe-0.4.0 examples/legacy/not_checked/shoes-contrib/simple/simple-menu1.rb
scarpe-0.3.0 examples/legacy/not_checked/shoes-contrib/simple/simple-menu1.rb
scarpe-0.2.2 examples/legacy/not_checked/shoes-contrib/simple/simple-menu1.rb
lacci-0.2.1 examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb
lacci-0.2.1 examples/legacy/not_checked/shoes-contrib/simple/simple-menu1.rb
scarpe-0.2.1 examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb
scarpe-0.2.1 examples/legacy/not_checked/shoes-contrib/simple/simple-menu1.rb
scarpe-0.2.0 examples/legacy/not_checked/shoes-dep-samples/simple-menu1.rb
scarpe-0.2.0 examples/legacy/not_checked/shoes-contrib/simple/simple-menu1.rb
shoes-3.0.1 samples/simple-menu1.rb
shoesgem-0.1514.0 shoes/samples/simple-menu1.rb
shoesgem-0.1424.0 shoes/samples/simple-menu1.rb