How could you create a custom action in Cocos2D that could execute a “callback” over time, making each callback call longer than its last call (using something similar to the EaseExponentialOut action already provided with Cocos2D.
Something similar: (which does not work)
id sequence = [Sequence actions: [CallFunc actionWithTarget: self selector: @selector(spinTick)], [DelayTime actionWithDuration: 0.034f], nil];
id repeat = [Repeat actionWithAction: [sequence copy] times: 18];
id ease = [EaseExponentialOut actionWithAction: [repeat copy]];
[ease setDuration:4];
id play = [CallFunc actionWithTarget:self selector:@selector(play)];
[self runAction: [Sequence actions: [ease copy], [play copy], nil]];
The above code executes the entire “sequence” 18 times, and then performs a “play” callback at the end of the last sequence.
However, the EaseExponentialOut has no effect on the created repeat action - I expected it to adjust the duration of the DelayTime action inside the sequence action, but that doesn't seem to do it.
I also tried to create my own custom action based on IntervalAction, but failed.
source
share