36
36
#import " CCActionEase.h"
37
37
38
38
#ifndef M_PI_X_2
39
- #define M_PI_X_2 ( float ) M_PI * 2 .0f
39
+ #define M_PI_X_2 M_PI * 2.0
40
40
#endif
41
41
42
42
#pragma mark EaseAction
@@ -98,7 +98,7 @@ -(CCActionInterval*) reverse
98
98
@implementation CCActionEaseSineIn
99
99
-(void ) update : (CCTime) t
100
100
{
101
- [_inner update: -1 *cosf (t * ( float ) M_PI_2) +1 ];
101
+ [_inner update: -1 *cosf (t * M_PI_2) +1 ];
102
102
}
103
103
104
104
- (CCActionInterval*) reverse
@@ -113,7 +113,7 @@ - (CCActionInterval*) reverse
113
113
@implementation CCActionEaseSineOut
114
114
-(void ) update : (CCTime) t
115
115
{
116
- [_inner update: sinf (t * ( float ) M_PI_2)];
116
+ [_inner update: sinf (t * M_PI_2)];
117
117
}
118
118
119
119
- (CCActionInterval*) reverse
@@ -128,7 +128,7 @@ - (CCActionInterval*) reverse
128
128
@implementation CCActionEaseSineInOut
129
129
-(void ) update : (CCTime) t
130
130
{
131
- [_inner update: -0 .5f *(cosf ( ( float ) M_PI*t) - 1 )];
131
+ [_inner update: -0.5 *(cosf ( M_PI*t) - 1 )];
132
132
}
133
133
@end
134
134
@@ -138,12 +138,12 @@ -(void) update: (CCTime) t
138
138
139
139
@implementation CCActionEaseRate
140
140
@synthesize rate=_rate;
141
- +(instancetype ) actionWithAction : (CCActionInterval*) action rate : (float )rate
141
+ +(instancetype ) actionWithAction : (CCActionInterval*) action rate : (CGFloat )rate
142
142
{
143
143
return [[self alloc ] initWithAction: action rate: rate];
144
144
}
145
145
146
- -(id ) initWithAction : (CCActionInterval*) action rate : (float )rate
146
+ -(id ) initWithAction : (CCActionInterval*) action rate : (CGFloat )rate
147
147
{
148
148
if ( (self=[super initWithAction: action ]) )
149
149
self.rate = rate;
@@ -176,7 +176,7 @@ -(void) update: (CCTime) t
176
176
@implementation CCActionEaseOut
177
177
-(void ) update : (CCTime) t
178
178
{
179
- [_inner update: 1 .0f - powf (1 .0f - t, _rate)];
179
+ [_inner update: 1.0 - powf (1.0 - t, _rate)];
180
180
}
181
181
@end
182
182
@@ -186,10 +186,10 @@ -(void) update: (CCTime) t
186
186
{
187
187
t *= 2 ;
188
188
if (t < 1 ) {
189
- [_inner update: 0 .5f * powf (t, _rate)];
189
+ [_inner update: 0.5 * powf (t, _rate)];
190
190
}
191
191
else {
192
- [_inner update: 1 .0f - 0 .5f * powf (2 -t, _rate)];
192
+ [_inner update: 1.0 - 0.5 * powf (2 -t, _rate)];
193
193
}
194
194
}
195
195
@@ -211,20 +211,20 @@ @implementation CCActionEaseElastic
211
211
212
212
+(instancetype ) actionWithAction : (CCActionInterval*) action
213
213
{
214
- return [[self alloc ] initWithAction: action period: 0 .3f ];
214
+ return [[self alloc ] initWithAction: action period: 0.3 ];
215
215
}
216
216
217
- +(instancetype ) actionWithAction : (CCActionInterval*) action period : (float )period
217
+ +(instancetype ) actionWithAction : (CCActionInterval*) action period : (CGFloat )period
218
218
{
219
219
return [[self alloc ] initWithAction: action period: period];
220
220
}
221
221
222
222
-(id ) initWithAction : (CCActionInterval*) action
223
223
{
224
- return [self initWithAction: action period: 0 .3f ];
224
+ return [self initWithAction: action period: 0.3 ];
225
225
}
226
226
227
- -(id ) initWithAction : (CCActionInterval*) action period : (float )period
227
+ -(id ) initWithAction : (CCActionInterval*) action period : (CGFloat )period
228
228
{
229
229
if ( (self=[super initWithAction: action]) )
230
230
_period = period;
@@ -255,7 +255,7 @@ -(void) update: (CCTime) t
255
255
newT = t;
256
256
257
257
else {
258
- float s = _period / 4 ;
258
+ CGFloat s = _period / 4 ;
259
259
t = t - 1 ;
260
260
newT = -powf (2 , 10 * t) * sinf ( (t-s) *M_PI_X_2 / _period);
261
261
}
@@ -279,7 +279,7 @@ -(void) update: (CCTime) t
279
279
newT = t;
280
280
281
281
} else {
282
- float s = _period / 4 ;
282
+ CGFloat s = _period / 4 ;
283
283
newT = powf (2 , -10 * t) * sinf ( (t-s) *M_PI_X_2 / _period) + 1 ;
284
284
}
285
285
[_inner update: newT];
@@ -303,14 +303,14 @@ -(void) update: (CCTime) t
303
303
else {
304
304
t = t * 2 ;
305
305
if (! _period )
306
- _period = 0 .3f * 1 .5f ;
306
+ _period = 0.3 * 1.5 ;
307
307
CCTime s = _period / 4 ;
308
308
309
309
t = t -1 ;
310
310
if ( t < 0 )
311
- newT = -0 .5f * powf (2 , 10 * t) * sinf ((t - s) * M_PI_X_2 / _period);
311
+ newT = -0.5 * powf (2 , 10 * t) * sinf ((t - s) * M_PI_X_2 / _period);
312
312
else
313
- newT = powf (2 , -10 * t) * sinf ((t - s) * M_PI_X_2 / _period) * 0 .5f + 1 ;
313
+ newT = powf (2 , -10 * t) * sinf ((t - s) * M_PI_X_2 / _period) * 0.5 + 1 ;
314
314
}
315
315
[_inner update: newT];
316
316
}
@@ -330,19 +330,19 @@ @implementation CCActionEaseBounce
330
330
-(CCTime) bounceTime : (CCTime) t
331
331
{
332
332
if (t < 1 / 2.75 ) {
333
- return 7 .5625f * t * t;
333
+ return 7.5625 * t * t;
334
334
}
335
335
else if (t < 2 / 2.75 ) {
336
- t -= 1 .5f / 2 .75f ;
337
- return 7 .5625f * t * t + 0 .75f ;
336
+ t -= 1.5 / 2.75 ;
337
+ return 7.5625 * t * t + 0.75 ;
338
338
}
339
339
else if (t < 2.5 / 2.75 ) {
340
- t -= 2 .25f / 2 .75f ;
341
- return 7 .5625f * t * t + 0 .9375f ;
340
+ t -= 2.25 / 2.75 ;
341
+ return 7.5625 * t * t + 0.9375 ;
342
342
}
343
343
344
- t -= 2 .625f / 2 .75f ;
345
- return 7 .5625f * t * t + 0 .984375f ;
344
+ t -= 2.625 / 2.75 ;
345
+ return 7.5625 * t * t + 0.984375 ;
346
346
}
347
347
@end
348
348
@@ -397,9 +397,9 @@ -(void) update: (CCTime) t
397
397
newT = t;
398
398
else if (t < 0.5 ) {
399
399
t = t * 2 ;
400
- newT = (1 - [self bounceTime: 1 -t] ) * 0 .5f ;
400
+ newT = (1 - [self bounceTime: 1 -t] ) * 0.5 ;
401
401
} else
402
- newT = [self bounceTime: t * 2 - 1 ] * 0 .5f + 0 .5f ;
402
+ newT = [self bounceTime: t * 2 - 1 ] * 0.5 + 0.5 ;
403
403
404
404
[_inner update: newT];
405
405
}
@@ -413,7 +413,7 @@ @implementation CCActionEaseBackIn
413
413
414
414
-(void ) update : (CCTime) t
415
415
{
416
- CCTime overshoot = 1 .70158f ;
416
+ CCTime overshoot = 1.70158 ;
417
417
[_inner update: t * t * ((overshoot + 1 ) * t - overshoot)];
418
418
}
419
419
@@ -427,7 +427,7 @@ - (CCActionInterval*) reverse
427
427
@implementation CCActionEaseBackOut
428
428
-(void ) update : (CCTime) t
429
429
{
430
- CCTime overshoot = 1 .70158f ;
430
+ CCTime overshoot = 1.70158 ;
431
431
432
432
t = t - 1 ;
433
433
[_inner update: t * t * ((overshoot + 1 ) * t + overshoot) + 1 ];
@@ -444,7 +444,7 @@ @implementation CCActionEaseBackInOut
444
444
445
445
-(void ) update : (CCTime) t
446
446
{
447
- CCTime overshoot = 1 .70158f * 1 .525f ;
447
+ CCTime overshoot = 1.70158 * 1.525 ;
448
448
449
449
t = t * 2 ;
450
450
if (t < 1 )
0 commit comments