Skip to content

Instantly share code, notes, and snippets.

@dabing1022
Last active December 17, 2015 08:49
Show Gist options
  • Save dabing1022/5582404 to your computer and use it in GitHub Desktop.
Save dabing1022/5582404 to your computer and use it in GitHub Desktop.
CCAnimationAbout
NSMutableArray *frames = [NSMutableArray arrayWithCapacity:4];
for(int i = 0; i < 4; i++){
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"lampMenuAni%d.png",i]];
[frames addObject:frame];
}
CCAnimation *myAnimation = [CCAnimation animationWithSpriteFrames:frames delay:0.15f];
id animate = [CCAnimate actionWithAnimation:myAnimation];
id repeat = [CCRepeatForever actionWithAction:animate];
[sprite runAction:repeat];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment