Skip to content

Instantly share code, notes, and snippets.

@is8r
Created June 27, 2014 13:44
Show Gist options
  • Save is8r/83eebccefd2289eb453d to your computer and use it in GitHub Desktop.
Save is8r/83eebccefd2289eb453d to your computer and use it in GitHub Desktop.
// PuruBtn.m
#import "PuruBtn.h"
@implementation PuruBtn
- (void)_init
{
[self schedule:@selector(tick:) interval: 1.0f];//初回は一秒後に実行
}
- (void)tick:(ccTime) dt
{
//プルプルさせる処理
id step0;
id step1;
id easeAction;
step0 = [CCRotateBy actionWithDuration:0.1f angle:3];
step1 = [CCRotateBy actionWithDuration:0.6f angle:-3];
easeAction = [CCEaseElasticOut actionWithAction:step1];
[self runAction:[CCSequence actions:step0, easeAction, nil]];
//次回の実行をランダムで設定
srand(rand()%99 + time(nil));
float time = rand()%3;
[self unschedule:@selector(tick:)];
[self schedule:@selector(tick:) interval: time];//
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment