Skip to content

Instantly share code, notes, and snippets.

@is8r
Created June 27, 2014 13:43
Show Gist options
  • Save is8r/6705c010dcd52cd81d71 to your computer and use it in GitHub Desktop.
Save is8r/6705c010dcd52cd81d71 to your computer and use it in GitHub Desktop.
// PuyoBtn.m
#import "PuyoBtn.h"
@implementation PuyoBtn
enum{
kTagSequence,
};
- (void)_press
{
//release時のアクションを実行中の場合はキャンセルします
[self stopActionByTag:kTagSequence];
//ちょっと拡大します
id step0;
id easeAction;
CCSequence* sequence;
step0 = [CCScaleTo actionWithDuration:0.1f scale:1.1f];
easeAction = [CCEaseElasticOut actionWithAction:step0];
sequence = [CCSequence actions:step0, easeAction, nil];
sequence.tag = kTagSequence;
[self runAction:sequence];
}
- (void)_release
{
//_press時のアクションを実行中の場合はキャンセルします
[self stopActionByTag:kTagSequence];
//元の大きさに戻します
id step0;
id easeAction;
CCSequence* sequence;
step0 = [CCScaleTo actionWithDuration:0.3f scale:1.0f];
easeAction = [CCEaseElasticOut actionWithAction:step0];
sequence = [CCSequence actions:step0, easeAction, nil];
sequence.tag = kTagSequence;
[self runAction:sequence];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment