Sha256: 52a832e25660387cc4d3e07cfc8e39206857b1f80948072a59c90a5935f693a9

Contents?: true

Size: 700 Bytes

Versions: 27

Compression:

Stored size: 700 Bytes

Contents

require '../lib/green_shoes'

xspeed, yspeed = 10, 6
xdir, ydir = 1, 1

Shoes.app width: 300, height: 300 do
  a = nil
  p = para 'Hello', ' World!', top: 30
  button('pause'){a.pause}
  button('stop'){a.stop}
  button('move'){p.move 200, 30}
  button('remove'){p.clear}
  img = image '../static/gshoes-icon.png'
  img.click{alert "You're soooo quick!"}

  x, y = 150, 150
  size = [128, 128]
  pause = 0

  a = animate(24, false) do |n|
    unless pause == n
      x += xspeed * xdir
      y += yspeed * ydir

      xdir *= -1 if x > 300 - size[0] or x < 0
      ydir *= -1 if y > 300 - size[1] or y < 0

      img.move x.to_i, y.to_i
    end
    pause = n
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
green_shoes-1.0.337 samples/sample1.rb
green_shoes-1.0.331 samples/sample1.rb
green_shoes-1.0.322 samples/sample1.rb
green_shoes-1.0.320 samples/sample1.rb
green_shoes-1.0.309 samples/sample1.rb
green_shoes-1.0.303 samples/sample1.rb
green_shoes-1.0.282 samples/sample1.rb
green_shoes-1.0.273 samples/sample1.rb
green_shoes-0.263.0 samples/sample1.rb
green_shoes-0.255.0 samples/sample1.rb
green_shoes-0.243.0 samples/sample1.rb
green_shoes-0.233.0 samples/sample1.rb
green_shoes-0.227.0 samples/sample1.rb
green_shoes-0.226.0 samples/sample1.rb
green_shoes-0.221.0 samples/sample1.rb
green_shoes-0.214.0 samples/sample1.rb
green_shoes-0.207.0 samples/sample1.rb
green_shoes-0.201.0 samples/sample1.rb
green_shoes-0.198.0 samples/sample1.rb
green_shoes-0.189.0 samples/sample1.rb