Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocos2d iphone CCEaseIn etc内部CCSequence_Cocos2d Iphone_Sequence_Easing - Fatal编程技术网

Cocos2d iphone CCEaseIn etc内部CCSequence

Cocos2d iphone CCEaseIn etc内部CCSequence,cocos2d-iphone,sequence,easing,Cocos2d Iphone,Sequence,Easing,你到底是如何使用这个序列的 以下是一个例子。这将使我的mapNode回到左边框,例如,当弹出LHS菜单时。移动持续时间和加速度计算为预期位移的函数: - (void)setLeftClamp:(float)leftClamp { _leftClamp = leftClamp; CGPoint currentPosition = self.mapNode.position; if (currentPosition.x > self.maxX) {

你到底是如何使用这个序列的


以下是一个例子。这将使我的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;

    }

}

这看起来很像我已经尝试过的。只是增加了序列的易用性——只有一个例外;速率参数。如果未指定速率,则ease不起作用(只是立即跳到结束值)。如果指定了rate(我只是将其设置为1),它就可以工作。