I'm trying to use the CCRipple 3D with Cocos2D like this:
-(void) addNewSpriteWithCoords:(CGPoint)p
{
id rippleAction = [CCRipple3D actionWithPosition:CGPointMake(p.x,p.y) radius:200 waves:10 amplitude:50 grid:ccg(32,24) duration:10];
[self runA开发者_C百科ction:[CCSequence actions:rippleAction, [CCStopGrid action], nil]];
}
(where p.x,and p.y correspond to the coordinates of every touch.)
But, when the effect is over it stops suddenly, and I have no idea how to change that? (I know that CCStopGrid stops the action in the grid, but I have no more clues)
Anyone knows how can I make the effect stops smoothly?
Thank you so much.
Wrap the CCSequence in CCSpeed:
CCSequence* sequence = // action bits
CCSpeed* speed = [CCSpeed actionWithAction:sequence speed:1.0f];
Save speed, say in a class variable, then using another function, say the standard update method to modify the speed however you like using setSpeed:
.
Yeah, that worked Sold Out Activist (sorry for answer you so late)! what I did was:
-(void) addNewSpriteWithCoords:(CGPoint)p
{
id rippleAction = [CCRipple3D actionWithPosition:CGPointMake(p.x,p.y) radius:150 waves:1 amplitude:50 grid:ccg(50,50) duration:0.9];
id rippleAction2 = [CCRipple3D actionWithPosition:CGPointMake(p.x,p.y) radius:150 waves:1 amplitude:25 grid:ccg(50,50) duration:0.8];
id rippleAction5 = [CCRipple3D actionWithPosition:CGPointMake(p.x,p.y) radius:150 waves:1 amplitude:5 grid:ccg(50,50) duration:1.1];
[fondo runAction:[CCSequence actions:rippleAction, rippleAction2, rippleAction5, [CCStopGrid action], nil]];
}
You can use one of the many 'ease' actions to smoothly scale the time another action takes.
- There is this this post at the cocos2D homepage.
- Azam Sharp has a video about the topic on YouTube:
And of course there are the API docs (Just two examples here, there are about 30 variations) But the many variations are all basically variations with different speeds, forward, revers and combinations of them.
- Ease In
- Ease Out
精彩评论