YHBasicAnimation.h
1.68 KB
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
//
// YHBasicAnimation.h
// YHAnimationDemo
//
// Created by gaoqiang xu on 2/9/15.
// Copyright (c) 2015 gaoqiang. All rights reserved.
//
#import "YHAnimationProxy.h"
#import "YHShorthand.h"
/**
* 基础类动画
*/
@interface YHBasicAnimation : YHAnimationProxy
/**
* 时长
*/
@property (assign, nonatomic) CFTimeInterval duration;
/**
* 时间函数
*/
@property (strong, nonatomic) CAMediaTimingFunction *timingFunction;
@end
/**
* NSObject扩展
使用下面4个方法可以直接快速创建一个YHBasicAnimation实例
*/
@interface NSObject (YHBasicAnimation)
@property (assign, nonatomic) CFTimeInterval pop_duration;
/**
* 获取线性动画的实例
*
* @return 动画代理实例 YHBasicAnimation
*/
- (instancetype)pop_linear;
/**
* 获取淡入动画的实例
*
* @return 动画代理实例 YHBasicAnimation
*/
- (instancetype)pop_easeIn;
/**
* 获取淡出动画的实例
*
* @return 动画代理实例 YHBasicAnimation
*/
- (instancetype)pop_easeOut;
/**
* 获取淡入淡出动画的实例
*
* @return 动画代理实例 YHBasicAnimation
*/
- (instancetype)pop_easeInEaseOut;
@end
#pragma mark - 简写模式
#ifdef YHANIMATE_SHORTHAND
@interface NSObject (YHBasicAnimation_DropPrefix)
@property (assign, nonatomic) CFTimeInterval duration;
- (instancetype)linear;
- (instancetype)easeIn;
- (instancetype)easeOut;
- (instancetype)easeInEaseOut;
@end
@implementation NSObject (YHBasicAnimation_DropPrefix)
YHSHORTHAND_PROPERTY(duration, Duration, CFTimeInterval)
YHSHORTHAND_GETTER(linear, instancetype)
YHSHORTHAND_GETTER(easeIn, instancetype)
YHSHORTHAND_GETTER(easeOut, instancetype)
YHSHORTHAND_GETTER(easeInEaseOut, instancetype)
@end
#endif