Cancel Rubys Shoes animation

I am starting to code GUIs using Shoe. I tried the progress bar from the examples, but could not exit the animation, it breakdid not work ...

animate do |frames|
  unless frames > 100
    @p.fraction = (frames % 100) / 100.0
  else
    break
  end
end

Is it possible to stop the animation with shoes? Thank.

+5
source share
1 answer

sure stop does it

Shoes.app do
  stack :margin => 0.1 do
    title "Progress example"
    @p = progress :width => 1.0
    @animate = animate (24) do |i|
      @p.fraction = (i % 100) / 100.0
      @animate.stop if i > 99
    end
  end
end
+3
source

All Articles