@@ -37,6 +37,33 @@ + (NSArray *)keyFramesWithTimesAndAlphas:(NSInteger)pairCount,...
37
37
}
38
38
}
39
39
40
+ + (NSArray *)keyFramesWithTimesAndCornerRadius : (NSInteger )pairCount ,...
41
+ {
42
+ va_list argumentList;
43
+ NSInteger time ;
44
+ CGFloat cornerRadius;
45
+ if (pairCount > 0 ) {
46
+ NSMutableArray *keyFrames = [NSMutableArray arrayWithCapacity: (NSUInteger )pairCount];
47
+
48
+ va_start (argumentList, pairCount);
49
+
50
+ for (int i=0 ; i<pairCount; i++) {
51
+ time = va_arg (argumentList, NSInteger );
52
+ cornerRadius = (CGFloat )va_arg (argumentList, double ); // use double to suppress a va_arg conversion warning
53
+ IFTTTAnimationKeyFrame *keyFrame = [IFTTTAnimationKeyFrame keyFrameWithTime: time
54
+ andCornerRadius: cornerRadius];
55
+ [keyFrames addObject: keyFrame];
56
+ }
57
+
58
+ va_end (argumentList);
59
+
60
+ return [NSArray arrayWithArray: keyFrames];
61
+ }
62
+ else {
63
+ return nil ;
64
+ }
65
+ }
66
+
40
67
+ (NSArray *)keyFramesWithTimesAndFrames : (NSInteger )pairCount ,...
41
68
{
42
69
va_list argumentList;
@@ -226,6 +253,13 @@ + (instancetype)keyFrameWithTime:(NSInteger)time andAlpha:(CGFloat)alpha
226
253
return keyFrame;
227
254
}
228
255
256
+ + (instancetype )keyFrameWithTime : (NSInteger )time andCornerRadius : (CGFloat )cornerRadius
257
+ {
258
+ IFTTTAnimationKeyFrame *keyFrame = [[self alloc ] initWithTime: time
259
+ andCornerRadius: cornerRadius];
260
+ return keyFrame;
261
+ }
262
+
229
263
+ (instancetype )keyFrameWithTime : (NSInteger )time andFrame : (CGRect )frame
230
264
{
231
265
IFTTTAnimationKeyFrame *keyFrame = [[self alloc ] initWithTime: time
@@ -279,10 +313,8 @@ + (instancetype)keyFrameWithTime:(NSInteger)time andConstraint:(CGFloat)constrai
279
313
}
280
314
281
315
- (id )initWithTime : (NSInteger )time
282
- {
283
- self = [super init ];
284
-
285
- if (self) {
316
+ {
317
+ if ((self = [self init ])) {
286
318
self.time = time ;
287
319
self.easingFunction = IFTTTEasingFunctionLinear;
288
320
}
@@ -292,20 +324,25 @@ - (id)initWithTime:(NSInteger)time
292
324
293
325
- (id )initWithTime : (NSInteger )time andAlpha : (CGFloat )alpha
294
326
{
295
- self = [self initWithTime: time ];
296
-
297
- if (self) {
327
+ if ((self = [self initWithTime: time ])) {
298
328
self.alpha = alpha;
299
329
}
300
330
301
331
return self;
302
332
}
303
333
334
+ - (id )initWithTime : (NSInteger )time andCornerRadius : (CGFloat )cornerRadius
335
+ {
336
+ if ((self = [self initWithTime: time ])) {
337
+ self.cornerRadius = cornerRadius;
338
+ }
339
+
340
+ return self;
341
+ }
342
+
304
343
- (id )initWithTime : (NSInteger )time andFrame : (CGRect )frame
305
344
{
306
- self = [self initWithTime: time ];
307
-
308
- if (self) {
345
+ if ((self = [self initWithTime: time ])) {
309
346
self.frame = frame;
310
347
}
311
348
@@ -314,9 +351,7 @@ - (id)initWithTime:(NSInteger)time andFrame:(CGRect)frame
314
351
315
352
- (id )initWithTime : (NSInteger )time andHidden : (BOOL )hidden
316
353
{
317
- self = [self initWithTime: time ];
318
-
319
- if (self) {
354
+ if ((self = [self initWithTime: time ])) {
320
355
self.hidden = hidden;
321
356
}
322
357
@@ -325,9 +360,7 @@ - (id)initWithTime:(NSInteger)time andHidden:(BOOL)hidden
325
360
326
361
- (id )initWithTime : (NSInteger )time andColor : (UIColor*)color
327
362
{
328
- self = [self initWithTime: time ];
329
-
330
- if (self) {
363
+ if ((self = [self initWithTime: time ])) {
331
364
self.color = color;
332
365
}
333
366
@@ -336,9 +369,7 @@ - (id)initWithTime:(NSInteger)time andColor:(UIColor*)color
336
369
337
370
- (id )initWithTime : (NSInteger )time andAngle : (CGFloat )angle
338
371
{
339
- self = [self initWithTime: time ];
340
-
341
- if (self) {
372
+ if ((self = [self initWithTime: time ])) {
342
373
self.angle = angle;
343
374
}
344
375
@@ -347,29 +378,23 @@ - (id)initWithTime:(NSInteger)time andAngle:(CGFloat)angle
347
378
348
379
- (id )initWithTime : (NSInteger )time andTransform3D : (IFTTTTransform3D *)transform
349
380
{
350
- self = [self initWithTime: time ];
351
-
352
- if (self) {
381
+ if ((self = [self initWithTime: time ])) {
353
382
self.transform = transform;
354
383
}
355
384
356
385
return self;
357
386
}
358
387
359
388
- (id )initWithTime : (NSInteger )time andScale : (CGFloat )scale {
360
- self = [self initWithTime: time ];
361
-
362
- if (self) {
389
+ if ((self = [self initWithTime: time ])) {
363
390
self.scale = scale;
364
391
}
365
392
366
393
return self;
367
394
}
368
395
369
396
- (id )initWithTime : (NSInteger )time andConstraint : (CGFloat )constraint {
370
- self = [self initWithTime: time ];
371
-
372
- if (self) {
397
+ if ((self = [self initWithTime: time ])) {
373
398
self.constraintConstant = constraint;
374
399
}
375
400
0 commit comments