5

I'm starting to code GUIs with Shoes. I tried the progress bar from the examples, but I found no way to exit the animation, break did not work...

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

Is there any possibility to stop a animation with Shoes? Thanks.

1 Answers1

2

sure, stop does that

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
peter
  • 41,770
  • 5
  • 64
  • 108