2014-06-15 14 views
1

我使用下面的代碼來運行動畫,但如何反轉動畫? (例如,戶型有一個開放的動畫,但我想,使其接近)如何使用Cocos3D運行反轉動畫?

CC3ResourceNode* rezNode = [CC3PODResourceNode nodeFromFile: @"bd1hW1368.POD"]; 
    [self addChild: rezNode]; 

    CCActionInterval *stride = [CC3Animate actionWithDuration:10.0]; 
    [rezNode runAction:[CCRepeatForever actionWithAction:stride]]; 

[更新]

相關比爾的答案,我接近創建一個連續的門/開啓動畫如下:

CC3ResourceNode* rezNode = [CC3PODResourceNode nodeFromFile: @"bd1hW1368.POD"]; 
    [self addChild: rezNode]; 

    CC3Animate *stride = [CC3Animate actionWithDuration:10.0]; 
    CC3Animate *reversedStride = [CC3Animate actionWithDuration:10.0]; 
    reversedStride.isReversed = YES; 

    CCRepeatForever *repeat = [CCRepeatForever actionWithAction:[CCSequence actionWithArray:@[stride, reversedStride]]]; 
    [rezNode runAction:repeat]; 

回答

1

像大多數CCActionInterval亞類,CC3Animate支持reverse方法,它返回一個新的CC3Animate實例配置爲向後運行。

您也可以重複使用相同CC3Animate實例和isReversed屬性設置爲YES,但使用reverse方法可以讓你更輕鬆地做這樣的事情序列的開門動作接着一個關門動作創建一個單獨的實例。

+0

謝謝比爾,它的工作原理,我用答案更新我的問題。 – ZYiOS