@@ -125,6 +125,12 @@ - (void)setupMotionStreakNodeTest
125
125
}
126
126
}
127
127
128
+ static float
129
+ ProgressPercent (CCTime t)
130
+ {
131
+ return 100.0 *fmod (t, 1.0 );
132
+ }
133
+
128
134
- (void )setupProgressNodeTest
129
135
{
130
136
self.subTitle = @" Testing various CCProgressNode setups." ;
@@ -148,7 +154,7 @@ - (void)setupProgressNodeTest
148
154
[self .contentNode addChild: progress];
149
155
150
156
[self scheduleBlock: ^(CCTimer *timer) {
151
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
157
+ progress.percentage = ProgressPercent ( timer.invokeTime );
152
158
[timer repeatOnceWithInterval: interval];
153
159
} delay: interval];
154
160
}
@@ -173,7 +179,7 @@ - (void)setupProgressNodeTest
173
179
174
180
[self scheduleBlock: ^(CCTimer *timer) {
175
181
progress.midpoint = ccpAdd (ccp (0.5 , 0.5 ), ccpMult (ccpForAngle (timer.invokeTime ), 0.25 ));
176
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
182
+ progress.percentage = ProgressPercent ( timer.invokeTime );
177
183
178
184
[timer repeatOnceWithInterval: interval];
179
185
} delay: interval];
@@ -199,7 +205,7 @@ - (void)setupProgressNodeTest
199
205
[self .contentNode addChild: progress];
200
206
201
207
[self scheduleBlock: ^(CCTimer *timer) {
202
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
208
+ progress.percentage = ProgressPercent ( timer.invokeTime );
203
209
204
210
[timer repeatOnceWithInterval: interval];
205
211
} delay: interval];
@@ -225,7 +231,7 @@ - (void)setupProgressNodeTest
225
231
[self .contentNode addChild: progress];
226
232
227
233
[self scheduleBlock: ^(CCTimer *timer) {
228
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
234
+ progress.percentage = ProgressPercent ( timer.invokeTime );
229
235
230
236
[timer repeatOnceWithInterval: interval];
231
237
} delay: interval];
@@ -251,7 +257,7 @@ - (void)setupProgressNodeTest
251
257
[self .contentNode addChild: progress];
252
258
253
259
[self scheduleBlock: ^(CCTimer *timer) {
254
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
260
+ progress.percentage = ProgressPercent ( timer.invokeTime );
255
261
256
262
[timer repeatOnceWithInterval: interval];
257
263
} delay: interval];
@@ -277,7 +283,7 @@ - (void)setupProgressNodeTest
277
283
[self .contentNode addChild: progress];
278
284
279
285
[self scheduleBlock: ^(CCTimer *timer) {
280
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
286
+ progress.percentage = ProgressPercent ( timer.invokeTime );
281
287
282
288
[timer repeatOnceWithInterval: interval];
283
289
} delay: interval];
@@ -303,7 +309,7 @@ - (void)setupProgressNodeTest
303
309
[self .contentNode addChild: progress];
304
310
305
311
[self scheduleBlock: ^(CCTimer *timer) {
306
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
312
+ progress.percentage = ProgressPercent ( timer.invokeTime );
307
313
308
314
[timer repeatOnceWithInterval: interval];
309
315
} delay: interval];
@@ -329,7 +335,7 @@ - (void)setupProgressNodeTest
329
335
[self .contentNode addChild: progress];
330
336
331
337
[self scheduleBlock: ^(CCTimer *timer) {
332
- progress.percentage = 100.0 *( 0.5 + 0.5 * sin ( timer.invokeTime *M_PI) );
338
+ progress.percentage = ProgressPercent ( timer.invokeTime );
333
339
334
340
[timer repeatOnceWithInterval: interval];
335
341
} delay: interval];
0 commit comments