cocos2d iphone - CCEaseIn etc inside CCSequence -
how use easing inside ccsequence?
related using cceaseout ccsequence?
here example. brings mapnode left border, example when lhs menu popped out. move duration , acceleration computed function of expected displacement :
- (void)setleftclamp:(float)leftclamp { _leftclamp = leftclamp; cgpoint currentposition = self.mapnode.position; if (currentposition.x > self.maxx) { // ease right in position cgpoint delta = ccp (self.maxx - currentposition.x, 0); id move = [ccmoveby actionwithduration:[self moveduration:delta] position:delta]; id ease = [cceasein actionwithaction:move rate:[self moveacceleration:delta]]; id delay = [ccdelaytime actionwithduration:.1f]; id easeandcenter = [ccsequence actions:ease, delay, [cccallfunc actionwithtarget:self selector:@selector(onmovecomplete)], nil]; [self.mapnode runaction:easeandcenter]; targetmaplocation_ = ccpadd(self.mapnode.position, delta); mapdisplacement_ = delta; ismapmoving_ = yes; } }
Comments
Post a Comment