0
   const float gravity = 9.8f;

    float L = 0.01f;

    double CurrentTime = CACurrentMediaTime();

    double angle = 40.0f * sin(sqrt((gravity/L)*CurrentTime));

    id rotation = [CCRotateTo actionWithDuration:3.0 angle:angle];
    id reverseRotation = [CCRotateTo actionWithDuration:3.0 angle:sprhang.rotation];
    [sprhang runAction:[CCRepeatForever actionWithAction:[CCSequence actions:rotation, reverseRotation , nil]]];
  // [sprhang runAction:[CCRepeatForever actionWithAction:[CCSequence actions:rotation,reverseRotation], nil]]];
     [self addChild:sprhang];

这是我显示精灵的钟摆效果的代码,它适用于不是 ARM64 的旧设备,顺便说一句,我在 CCRotationBY 和 CCRotationTO 的 CCAnmation Interval 类中进行了一些代码更改以支持 ARM64 设备。它工作正常..但我的问题是当我输入上面的代码时,第一个动作旋转工作正常,但是反向动作显示突然移动回到之前的位置,然后再次良好的第一次旋转,当反向移动的时间显示突然移动朝着最初的位置,我希望有人能帮助我。

4

0 回答 0