-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIView+TNRAnimationHelper.h
95 lines (76 loc) · 2.72 KB
/
UIView+TNRAnimationHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// Created by Alexandr Panchenko on 14/10/16.
// Copyright (c) 2016 Thunderrise. All rights reserved.
//
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// Latest version can be found at https://github.com/thunderrise/UIView-TNRAnimationHelper
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIView (TNRAnimationHelper)
/**
Direction of flip animation.
*/
typedef NS_ENUM(NSUInteger, UIViewAnimationFlipDirection) {
UIViewAnimationFlipDirectionFromTop,
UIViewAnimationFlipDirectionFromLeft,
UIViewAnimationFlipDirectionFromRight,
UIViewAnimationFlipDirectionFromBottom,
};
/**
Direction of rotation animation.
*/
typedef NS_ENUM(NSUInteger, UIViewAnimationRotationDirection) {
UIViewAnimationRotationDirectionRight,
UIViewAnimationRotationDirectionLeft
};
/**
Shakes the view horizontally for a short period of time.
*/
- (void)tnr_shakeHorizontally;
/**
Shakes the view vertically for a short period of time.
*/
- (void)tnr_shakeVertically;
/**
Performs a pulsing scale animation on a view.
@param scale - scale of animation.
@param duration - duration of the animation.
@param repeat - pass YES for the animation to repeat.
*/
- (void)tnr_pulseToSize:(CGFloat)scale
duration:(NSTimeInterval)duration
repeat:(BOOL)repeat;
/**
Performs a 3D-like flip animation of the view around center X or Y axis.
@param duration - total time of the animation.
@param direction - direction of the flip movement.
@param repeatCount - number of repetitions of the animation. Pass HUGE_VALF to repeat forever.
@param shouldAutoreverse - pass YES to make the animation reverse when it reaches the end.
*/
- (void)tnr_flipWithDuration:(NSTimeInterval)duration
direction:(UIViewAnimationFlipDirection)direction
repeatCount:(NSUInteger)repeatCount
autoreverse:(BOOL)shouldAutoreverse;
/**
Performs a rotation animation of the view around its anchor point.
@param angle - end angle of the rotation in degrees. 0° - 360°.
@param duration - total time of the animation.
@param direction - left or right direction of the rotation.
@param repeatCount - number of repetitions of the animation. Pass HUGE_VALF to repeat forever.
@param shouldAutoreverse - pass YES to make the animation reverse when it reaches the end.
*/
- (void)tnr_rotateToAngle:(CGFloat)angle
duration:(NSTimeInterval)duration
direction:(UIViewAnimationRotationDirection)direction
repeatCount:(NSUInteger)repeatCount
autoreverse:(BOOL)shouldAutoreverse;
/**
Stops current animations.
*/
- (void)tnr_stopAnimation;
/**
Checks if the view is being animated.
*/
- (BOOL)tnr_isBeingAnimated;
@end