【问题标题】:Abort Rubys Shoes animation中止红宝石鞋动画
【发布时间】:2011-12-17 17:25:15
【问题描述】:

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

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

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

【问题讨论】:

  • i 在块中贯穿了哪些值?是不是只能涨到100? (因为是进度条所以问)
  • i 代表动画完成的帧数。现在改了。
  • 没有收到您答复的电子邮件...谢谢!
  • 感谢您在这里提出这个问题,我花了一段时间才找到答案。

标签: ruby animation shoes


【解决方案1】:

当然,停止这样做

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

【讨论】:

    猜你喜欢
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多