Class: Shoes::Anim
Instance Method Summary collapse
- #continue? ⇒ Boolean
-
#initialize(cs, n = 100, repaint = true, &blk) ⇒ Anim
constructor
A new instance of Anim.
- #pause ⇒ Object
- #pause? ⇒ Boolean
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(cs, n = 100, repaint = true, &blk) ⇒ Anim
Returns a new instance of Anim.
3 4 5 |
# File 'lib/shoes/anim.rb', line 3 def initialize cs, n=100, repaint=true, &blk @cs, @n, @repaint, @i, @blk = cs, n, repaint, 0, blk end |
Instance Method Details
#continue? ⇒ Boolean
24 25 26 |
# File 'lib/shoes/anim.rb', line 24 def continue? !@stop end |
#pause ⇒ Object
28 29 30 |
# File 'lib/shoes/anim.rb', line 28 def pause @pause = !@pause end |
#pause? ⇒ Boolean
32 33 34 |
# File 'lib/shoes/anim.rb', line 32 def pause? @pause end |
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/shoes/anim.rb', line 7 def run if continue? @blk[@i = pause? ? @i : @i+1] if @cs.isDisposed stop return elsif @repaint @cs.redraw end Shoes.display.timerExec @n, self end end |
#stop ⇒ Object
20 21 22 |
# File 'lib/shoes/anim.rb', line 20 def stop @stop = true end |