我不确定我正在寻找的东西是否可行,但我只是在检查以确保我没有以困难的方式做事。
目前我有两个序列,它们同时运行。每个序列从等待 3 秒开始,然后一个序列缩放一个节点,另一个序列调整该节点的 alpha。所以代码看起来像这样:
node.runAction(SKAction.sequence([animationWait, animationScale]))
node.runAction(SKAction.sequence([animationWait, animationAlpha]))
但是有没有办法在一个序列中同时运行 animationScale 和 animationAlpha?所以它看起来像这样(这不起作用,但我希望你能看到我正在尝试做的事情):
node.runAction(SKAction.sequence([animationWait, (animationScale, animationAlpha)]))
最佳答案
您可以将操作组合成一个序列:
var actions = Array<SKAction>()
actions.append(SKAction.sequence([animationWait, animationScale]))
actions.append(SKAction.sequence([animationWait, animationAlpha]))
let group = SKAction.group(actions)
node.runAction(group)
When the action executes, the actions that comprise the group all start immediately and run in parallel. The duration of the group action is the longest duration among the collection of actions. If an action in the group has a duration less than the group’s duration, the action completes, then idles until the group completes the remaining actions. This matters most when creating a repeating action that repeats a group.
关于swift - 在一个序列中同时运行两个 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31119505/