Abort Rubys Shoes动画片

时间:2011-12-17 17:25:15

标签: ruby animation shoes

我开始使用Shoes编写GUI代码。我尝试了示例中的进度条,但我发现无法退出动画,break无法正常工作...

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

有没有可能用鞋停止动画?感谢。

1 个答案:

答案 0 :(得分:3)

当然,停止那样做

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