Class: Ray::Animation::BlockAnimation
- Inherits:
-
Ray::Animation
- Object
- Ray::Animation
- Ray::Animation::BlockAnimation
- Defined in:
- lib/ray/animation/block_animation.rb
Overview
Animation occurring by running a block. Registered as #block_animation.
Instance Attribute Summary
Attributes inherited from Ray::Animation
Instance Method Summary collapse
-
#-@ ⇒ BlockAnimation
Reversed animation.
- #setup(opts) ⇒ Object
- #update_target ⇒ Object
Methods inherited from Ray::Animation
#+, #-, #bounce!, #end_animation, #initialize, #loop!, #pause, #pause_animation, #paused?, #progression, register_for, #resume, #resume_animation, #running?, #setup_target, #start, #update
Methods included from Helper
#create_event_runner, #disable_event_group, effect_generator, #enable_event_group, #event_runner, #event_runner=, font, holding?, image, image_target, mouse_pos, music, #remove_event_group, #rotation, #scale_variation, sound, sound_buffer, sprite, text, #translation
Methods included from Matchers
Methods included from DSL::EventListener
#add_hook, #current_event_group, #current_event_group=, #event_group, #listener_runner, #listener_runner=, #on
Methods included from DSL::EventRaiser
#raise_event, #raiser_runner, #raiser_runner=
Constructor Details
This class inherits a constructor from Ray::Animation
Instance Method Details
#-@ ⇒ BlockAnimation
Returns Reversed animation.
30 31 32 33 |
# File 'lib/ray/animation/block_animation.rb', line 30 def -@ block_animation(:block => @block, :reversed => !@reversed, :duration => @duration) end |
#setup(opts) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ray/animation/block_animation.rb', line 18 def setup(opts) @block = opts[:block] || opts[:proc] @reversed = opts.key?(:reversed) ? opts[:reversed] : false self.duration = opts[:duration] end |
#update_target ⇒ Object
25 26 27 |
# File 'lib/ray/animation/block_animation.rb', line 25 def update_target @block.call(target, @reversed ? 1 - progression : progression) end |