Skip to content

MotionBlur allows you to add motion blur effect to iOS animations.

License

Notifications You must be signed in to change notification settings

ebfio/MotionBlur

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MotionBlur

MotionBlur allows you to add motion blur effect to your animations (currently only position's change). See the accompanying blog post to learn how it's implemented.

Demo GIF

Note how the text and icons on the menu get blurred when it slides in and out.

Usage

First, import it with:

#import "UIView+MotionBlur.h"

then use it with:

[yourView enableBlurWithAngle:M_PI_2 completion:^{
    [UIView animateWithDuration:0.5
                          delay:0
         usingSpringWithDamping:0.8
          initialSpringVelocity:0.3
                        options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState
                     animations:^{

        CGRect f = yourView.frame;
        f.origin = CGPointMake(0, 300);
        yourView.frame = f;
    } completion:^(BOOL finished) {
        [yourView disableBlur];
    }];
}];

Snapshot and blur are computed before the animation, that's why the API is asynchronous. You should also see the example project and read comments in the header file: Classes/UIView+MotionBlur.h.

Demo

To run the example project; clone the repo and open Example/MotionBlur.xcodeproj.

Requirements

  • iOS 8 and above

Installation

Copy files from Classes/ to your project. CocoaPod will be made available when iOS 8 comes out.

Author

Arkadiusz Holko:

About

MotionBlur allows you to add motion blur effect to iOS animations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published