Sha256: 075f7ef540d86648ff3a466d6779cff304b4bc97939f02ae7b4c073ce0a4f626

Contents?: true

Size: 539 Bytes

Versions: 6

Compression:

Stored size: 539 Bytes

Contents

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

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

  nostroke
  @icon = image "#{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.size
  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

6 entries across 6 versions & 1 rubygems

Version Path
shoesgem-0.1480.0 shoes/samples/simple-bounce.rb
shoesgem-0.1469.0 shoes/samples/simple-bounce.rb
shoesgem-0.1430.0 shoes/samples/simple-bounce.rb
shoesgem-0.1429.0 shoes/samples/simple-bounce.rb
shoesgem-0.1428.0 shoes/samples/simple-bounce.rb
shoesgem-0.1426.0 shoes/samples/simple-bounce.rb