[英]SKAction display single image for duration?
SKAction *ghostAnimationAction =
[SKAction animateWithTextures:ghostFrames timePerFrame:0.1];
SKAction *ghostDelayAction =
[SKAction animateWithTextures:@[[SKTexture textureWithImageNamed:@"Ghost_"]]
timePerFrame:1.0];
SKAction *ghostAnimationSequence =
[SKAction sequence:@[ghostAnimationAction, ghostDelayAction]];
SKAction *repeatGhostAnimationSequence =
[SKAction repeatActionForever:ghostAnimationSequence];
我有一個動畫的幀序列,由SKTexture
對象的NSMutableArray
SKTexture
。 播放完該序列后,我想在靜止幀上折疊一秒鍾,然后重復所有操作。 上面的代碼有效,但是我能找到的指定在幀上保持一段時間的唯一方法是使用animateWithTextures:timePerFrame:
並提供單個紋理數組。 有沒有一種方法可以讓SKAction
在我錯過的時間內顯示單個圖像。
您可以創建一個包含這兩個動作的新SKAction。 請參閱“ Sprite Kit編程指南”一節, “創建運行其他動作的動作 ”,此處將動作添加到節點。
看一下SKAction成員waitForDuration:同樣,您也可以避免以這種方式傳遞單個紋理。 讓第一個SKAction運行動畫,然后讓第二個SKAction waitForDuration。 然后,隨附的SKAction將永久或根據需要運行這兩個動作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.