Sha256: 839d82d987dfc950a963d363552597d4247ddc076e48a29c4007d6fbea40aa9d

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

module MotionWizard
  module AnimationStrategy
    class SlideAnimation < BaseAnimationStrategy
      attr_accessor :direction

      def animate
        do_slide_animation(@show_view, @direction*App.frame.size.width, 0, @show_view_after_block)
        do_slide_animation(@hide_view, 0, -@direction*App.frame.size.width, @hide_view_after_block)
      end

      def do_slide_animation(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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-wizard-0.1 lib/motion-wizard/animation_strategy/slide_animation.rb