• Stars
    star
    1,125
  • Rank 41,364 (Top 0.9 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A extension of POP(from facebook) custom animation. Inspired by tweaner(https://code.google.com/p/tweaner), MMTweanerAnimation provide 10 types of custom animation while using POP.

MMTweenAnimation

CocoaPods CocoaPods CocoaPods

demo

MMTweenAnimation is a extension of POP(from facebook) custom animation. Inspired by tweaner(https://code.google.com/p/tweaner), MMTweanerAnimation provide 10 types of custom animation while using POP.

Animation functions are based on Easing functions

Easing functions specify the rate of change of a parameter over time and allow you to apply custom mathematical formulas to your animations.

Installation

The preferred way of installation is via CocoaPods. Just add

pod 'MMTweenAnimation'

and run pod install. It will install the most recent version of MMTweenAnimation.

If you would like to use the latest code of MMTweenAnimation use:

pod 'MMTweenAnimation', :head

Type

There are 10 concrete animation types:

Back Bounce Circ Cubic Elastic
Expo Quad Quart Quint Sine

Usage

To apply a MMTweenAnimation, you must configure it by:

@property (nonatomic, copy)   MMTweenAnimationBlock  animationBlock;

@property (nonatomic, assign) NSArray *fromValue;
@property (nonatomic, assign) NSArray *toValue;
@property (nonatomic, assign) double duration;  //default: 0.3

@property (nonatomic, assign) MMTweenFunctionType functionType; //default: MMTweenFunctionBounce
@property (nonatomic, assign) MMTweenEasingType   easingType;   //default: MMTweenEasingOut

for example:

MMTweenAnimation *anim = [MMTweenAnimation animation];
anim.functionType   = MMTweenFunctionBounce;
anim.easingType     = MMTweenEasingOut;
anim.duration       = 2.0f;
anim.fromValue      = @[@0];
anim.toValue        = @[@200];
anim.animationBlock = ^(double c,double d,NSArray *v,id target,MMTweenAnimation *animation)
{
    //c: current time, from the beginning of animation
    //d: duration, always bigger than c
    //v: value, after the change at current time

    double value = [v[0] doubleValue];
    UIView *t = (UIView*)target;
    t.center = CGPointMake(t.x, value);
};

[targetView pop_addAnimation:anim forKey:@"center.y"];

Changelog

v1.1 you can animate several values at the same time

typedef void(^MMTweenAnimationBlock)(double c,   
                                     double d,  
                                     NSArray *v, // change to array
                                     id target,
                                     MMTweenAnimation *animation
                                     );

@property (nonatomic, strong) NSArray *fromValue;	// change to array
@property (nonatomic, strong) NSArray *toValue;		// change to array

v1.0 you can custom or simply use it by

@interface MMTweenAnimation : POPCustomAnimation

@property (nonatomic, copy)   MMTweenAnimationBlock  animationBlock;

@property (nonatomic, assign) double fromValue;
@property (nonatomic, assign) double toValue;
@property (nonatomic, assign) double duration;

@property (nonatomic, assign) MMTweenFunctionType functionType;
@property (nonatomic, assign) MMTweenEasingType   easingType;

+ (instancetype)animation;

@end

More Repositories

1

MMPopupView

Pop-up based view(e.g. alert sheet), can be easily customized.
Objective-C
2,108
star
2

MMPlaceHolder

A drop in solution to show UIView's size. Only one line code to use it.
Objective-C
982
star
3

MMParallaxCell

A subclass of UITableViewCell to present the parallax effect
Objective-C
456
star
4

MMSpinImageView

A UIView to show 360 degree spin photography
Objective-C
280
star
5

MMPulseView

Objective-C
184
star
6

DemoTaskTray

Demo shows advanced usage with iCarousel. A copycat of task tray in iOS9
Objective-C
151
star
7

DemoBackgroundLocationUpdate

Demo shows how to deal with background location update
Objective-C
130
star
8

XXPagingScrollView

Paged scrollView with custom paging width
Swift
113
star
9

DemoComplexCell

Demo for how to deal with complex cell
Objective-C
54
star
10

DemoQRCode

Demo shows how to deal with QRCode without 3rd party library
Objective-C
51
star
11

DemoMasonry

demo shows how to use Masonry.
Objective-C
49
star
12

MMNavigatorFont

A xcode plugin to change the font of navigator
Objective-C
46
star
13

DemoMasonryPlus

2015-12-12 douyu source & keynote
Objective-C
44
star
14

DemoDiallingCode

Demo shows how to deal with dialling code
Objective-C
36
star
15

DemoScrollViewAutolayout

Demo show how uiscrollview works with autolayout
Objective-C
35
star
16

DemoNavigationURI

Demo shows Navigation With URI
Objective-C
30
star
17

XXPlaceHolder

Swift version of MMPlaceHolder
Swift
26
star
18

MMCategory

categories i used in projects
Objective-C
18
star
19

DemoTodayWidget

Demo show how to build today widget programmatically
Objective-C
8
star
20

DemoAntiAliasing

Demo shows Anti-Aliasing with rotated image
Objective-C
7
star
21

XXPopupView

Swift version of MMPopupView
2
star
22

adad184.github.com

HTML
2
star
23

DemoAutolayout

1
star
24

adad184.github.com.source

JavaScript
1
star
25

TheManWhoChangedTengxun

You know it!
1
star