0

您如何在 CCSequence 中准确使用缓动?

将 CCEaseOut 与 CCSequence 一起使用有关吗?

4

1 回答 1

0

这是一个例子。这会将我的 mapNode 带回左边框,例如当弹出 LHS 菜单时。移动持续时间和加速度计算为预期位移的函数:

- (void)setLeftClamp:(float)leftClamp {

    _leftClamp = leftClamp;

    CGPoint currentPosition = self.mapNode.position;
    if (currentPosition.x > self.maxX) {
        // ease right back 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;

    }

}
于 2013-04-05T02:48:19.970 回答