Class: MotionWizard::AnimationStrategy::SlideAnimation
- Inherits:
-
BaseAnimationStrategy
- Object
- BaseAnimationStrategy
- MotionWizard::AnimationStrategy::SlideAnimation
- Defined in:
- lib/motion-wizard/animation_strategy/slide_animation.rb
Direct Known Subclasses
Ios7SlideLeftToRight, Ios7SlideRightToLeft, LeftToRight, RightToLeft
Instance Attribute Summary collapse
-
#direction ⇒ Object
Returns the value of attribute direction.
Attributes inherited from BaseAnimationStrategy
#already_on_final_position, #duration
Instance Method Summary collapse
Methods inherited from BaseAnimationStrategy
#hide_view, #initialize, #show_view
Constructor Details
This class inherits a constructor from MotionWizard::AnimationStrategy::BaseAnimationStrategy
Instance Attribute Details
#direction ⇒ Object
Returns the value of attribute direction.
4 5 6 |
# File 'lib/motion-wizard/animation_strategy/slide_animation.rb', line 4 def direction @direction end |
Instance Method Details
#animate ⇒ Object
6 7 8 9 |
# File 'lib/motion-wizard/animation_strategy/slide_animation.rb', line 6 def animate (@show_view, @direction*App.frame.size.width, 0, @show_view_after_block) (@hide_view, 0, -@direction*App.frame.size.width, @hide_view_after_block) end |
#do_slide_animation(view, initial_position, final_position, after_block) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/motion-wizard/animation_strategy/slide_animation.rb', line 11 def (view, initial_position, final_position, after_block) view.origin = [initial_position, view.origin.y] UIView.animateWithDuration(@duration, animations: -> { view.origin = [final_position, view.origin.y] },completion: ->(finished) { after_block.call(view) if after_block }) end |