如何使用 SKAction 连续循环 SKSprite 节点
How to continuously loop SKSprite Node using SKAction
在苹果文档中,文章的 sub-heading 中说:
"Load a sequence of images and play them back at a rate you define, while optionally looping the resulting animation."
然后提供此代码作为示例
let walkAnimation = SKAction.animate(with: monsterWalkTextures,
timePerFrame: 0.1)
node.run(walkAnimation)
// insert other code here to move the monster.
但从未显示如何有选择地循环播放动画??我很想知道如何循环播放动画。但更重要的是,我希望 LOVE 能够像其他语言一样在文档中找到有关该语言的所有详细信息。有人可以 please 告诉我在哪里可以找到这个神秘的文档,它比一个 "overview" 更详细,省略了语法可选循环 -.-
Here 我们可以看到所有 SKAction.animate 初始化,但我看不到 none 可以选择自行循环。现在,我不知道 "while optionally looping the resulting animation" 是否意味着当我们从 .animate 返回 SKAction 实例时,我们可以将它放在 .runForever
:
let animation = SKAction.repeatForever(.animate(with: textures, timePerFrame: 0.3, resize: true, restore: false))
run(animation)
我同意你的看法,如果他们将这篇文章放在 sub-head 中,他们至少可以提供一些基本示例。
在苹果文档中,文章的 sub-heading 中说:
"Load a sequence of images and play them back at a rate you define, while optionally looping the resulting animation."
然后提供此代码作为示例
let walkAnimation = SKAction.animate(with: monsterWalkTextures,
timePerFrame: 0.1)
node.run(walkAnimation)
// insert other code here to move the monster.
但从未显示如何有选择地循环播放动画??我很想知道如何循环播放动画。但更重要的是,我希望 LOVE 能够像其他语言一样在文档中找到有关该语言的所有详细信息。有人可以 please 告诉我在哪里可以找到这个神秘的文档,它比一个 "overview" 更详细,省略了语法可选循环 -.-
Here 我们可以看到所有 SKAction.animate 初始化,但我看不到 none 可以选择自行循环。现在,我不知道 "while optionally looping the resulting animation" 是否意味着当我们从 .animate 返回 SKAction 实例时,我们可以将它放在 .runForever
:
let animation = SKAction.repeatForever(.animate(with: textures, timePerFrame: 0.3, resize: true, restore: false))
run(animation)
我同意你的看法,如果他们将这篇文章放在 sub-head 中,他们至少可以提供一些基本示例。