A very simple code to produce an almost spring effect to a node. Play around with dropHeight and bounceFactor to get desired effect.
SKAction* bounce = [SKAction sequence:@[ [SKAction moveByX:0 y:dropHeight*bounceFactor duration:0.1f], [SKAction moveByX:0 y:-dropHeight*bounceFactor duration:0.1f], [SKAction moveByX:0 y:dropHeight*bounceFactor/2 duration:0.1f], [SKAction moveByX:0 y:-dropHeight*bounceFactor/2 duration:0.1f]]];
No comments:
Post a Comment