Git Product home page Git Product logo

rmpzoomtransitionanimator's Introduction

RMPZoomTransitionAnimator

Version License Platform

Overview

RMPZoomTransitionAnimator provide a custom transition zooming animation.

Not only UICollectionView, this is possible to use any other UIViewController transition.

This transition animation is like the "Pinterest" animation, but this is very simple and small library.

Screen shot Screen shot

Installation

RMPZoomTransitionAnimator is available through CocoaPods.
To install it, simply add the following line to your Podfile:

pod "RMPZoomTransitionAnimator"

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Setup is as below:

Use for an UINavigationController push transition

Refer to the example project for details.

  • Import RMPZoomTransitionAnimator.h
  • Adopt RMPZoomTransitionAnimating
  • Implement the RMPZoomTransitionAnimating protocol below, both source view controller and destination view controller
    1. - (UIImageView *)transitionSourceImageView
    2. - (UIColor *)transitionSourceBackgroundColor
    3. - (CGRect)transitionDestinationImageViewFrame
  • Returns RMPZoomTransitionAnimator instance in the UINavigationController delegate method
- (id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                   animationControllerForOperation:(UINavigationControllerOperation)operation
                                                fromViewController:(UIViewController *)fromVC
                                                  toViewController:(UIViewController *)toVC
{
    // minimum implementation for example
    RMPZoomTransitionAnimator *animator = [[RMPZoomTransitionAnimator alloc] init];
    animator.goingForward = (operation == UINavigationControllerOperationPush);
    animator.sourceTransition = (id<RMPZoomTransitionAnimating>)fromVC;
    animator.destinationTransition = (id<RMPZoomTransitionAnimating>)toVC;
    return animator;
}

Use for a modal transition

Refer to the example project for details.

  • Import RMPZoomTransitionAnimator.h
  • Adopt RMPZoomTransitionAnimating
  • Implement RMPZoomTransitionAnimating protocol below, both source view controller and destination view controller
    1. - (UIImageView *)transitionSourceImageView
    2. - (UIColor *)transitionSourceBackgroundColor
    3. - (CGRect)transitionDestinationImageViewFrame
  • Set the transitioningDelegate in prepareForSegue:sender:
  • Returns RMPZoomTransitionAnimator instance in the UIViewControllerTransitioningDelegate method
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                                  presentingController:(UIViewController *)presenting
                                                                      sourceController:(UIViewController *)source
{
    // minimum implementation for example
    RMPZoomTransitionAnimator *animator = [[RMPZoomTransitionAnimator alloc] init];
    animator.goingForward = YES;
    animator.sourceTransition = (id<RMPZoomTransitionAnimating>)source;
    animator.destinationTransition = (id<RMPZoomTransitionAnimating>)presented;
    return animator;
}

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
    // minimum implementation for example
    RMPZoomTransitionAnimator *animator = [[RMPZoomTransitionAnimator alloc] init];
    animator.goingForward = NO;
    animator.sourceTransition = (id<RMPZoomTransitionAnimating>)dismissed;
    animator.destinationTransition = (id<RMPZoomTransitionAnimating>)self;
    return animator;
}

Requirements

  • iOS 7.0 or higher

Change Log

1.0.3

  • Add option to change default animation duration
  • Fixed black screen

1.0.2

  • Remove alpha view and source image view from superview when completed

1.0.1

  • Adds animation completion handler

1.0.0

  • First release.

Contribution

If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues.

Author

Masato Oshima Recruit Marketing Partners Co.,Ltd. [email protected]

License

RMPZoomTransitionAnimator is available under the MIT license.

rmpzoomtransitionanimator's People

Contributors

mpon avatar ko0f avatar cocoabob avatar mickeyl avatar hikarusato avatar m1entus avatar

Watchers

heliang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.