Sha256: c51c8acbb54e03ae79d977ef57bf63000b3140c99cff35c99d53635b14e145ff

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

xspeed, yspeed = 8.4, 6.6
xdir, ydir = 1, 1

Shoes.app do
  background "#DFA"
  border black, strokewidth: 6

  nostroke
  @icon = image "#{Shoes::DIR}/static/shoes-icon.png", left: 100, top: 100 do
    alert "You're soooo quick."
  end

  x, y = self.width / 2, self.height / 2
  size = [@icon.height, @icon.width]
  animate(30) do
    x += xspeed * xdir
    y += yspeed * ydir

    xdir *= -1 if x > self.width - size[0] or x < 0
    ydir *= -1 if y > self.height - size[1] or y < 0

    @icon.move x.to_i, y.to_i
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-4.0.0.pre2 samples/simple-bounce.rb
shoes-4.0.0.pre1 samples/simple-bounce.rb