Class: Shoes::Animation
- Inherits:
-
Object
- Object
- Shoes::Animation
- Includes:
- Common::Inspect
- Defined in:
- shoes-core/lib/shoes/animation.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#blk ⇒ Object
readonly
Returns the value of attribute blk.
-
#current_frame ⇒ Object
readonly
Returns the value of attribute current_frame.
-
#framerate ⇒ Object
readonly
Returns the value of attribute framerate.
Instance Method Summary collapse
-
#increment_frame ⇒ Integer
Increments the current frame by 1.
-
#initialize(opts, &blk) ⇒ Animation
constructor
Creates a new Animation.
- #remove ⇒ Object
- #removed? ⇒ Boolean
- #start ⇒ Object
- #stop ⇒ Object
- #stopped? ⇒ Boolean
- #toggle ⇒ Object
Methods included from Common::Inspect
Constructor Details
#initialize(opts, &blk) ⇒ Animation
Creates a new Animation.
15 16 17 18 19 20 21 22 23 |
# File 'shoes-core/lib/shoes/animation.rb', line 15 def initialize(app, opts, blk) @style = opts @framerate = @style[:framerate] || 10 @app = app @blk = @app.current_slot.create_bound_block(blk) @current_frame = 0 @stopped = false @gui = Shoes.backend_for(self) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
25 26 27 |
# File 'shoes-core/lib/shoes/animation.rb', line 25 def app @app end |
#blk ⇒ Object (readonly)
Returns the value of attribute blk.
25 26 27 |
# File 'shoes-core/lib/shoes/animation.rb', line 25 def blk @blk end |
#current_frame ⇒ Object (readonly)
Returns the value of attribute current_frame.
25 26 27 |
# File 'shoes-core/lib/shoes/animation.rb', line 25 def current_frame @current_frame end |
#framerate ⇒ Object (readonly)
Returns the value of attribute framerate.
25 26 27 |
# File 'shoes-core/lib/shoes/animation.rb', line 25 def framerate @framerate end |
Instance Method Details
#increment_frame ⇒ Integer
Increments the current frame by 1
54 55 56 |
# File 'shoes-core/lib/shoes/animation.rb', line 54 def increment_frame @current_frame += 1 end |
#remove ⇒ Object
43 44 45 |
# File 'shoes-core/lib/shoes/animation.rb', line 43 def remove @removed = true end |
#removed? ⇒ Boolean
47 48 49 |
# File 'shoes-core/lib/shoes/animation.rb', line 47 def removed? @removed end |
#start ⇒ Object
27 28 29 |
# File 'shoes-core/lib/shoes/animation.rb', line 27 def start @stopped = false end |
#stop ⇒ Object
31 32 33 |
# File 'shoes-core/lib/shoes/animation.rb', line 31 def stop @stopped = true end |
#stopped? ⇒ Boolean
35 36 37 |
# File 'shoes-core/lib/shoes/animation.rb', line 35 def stopped? @stopped end |
#toggle ⇒ Object
39 40 41 |
# File 'shoes-core/lib/shoes/animation.rb', line 39 def toggle @stopped = !@stopped end |