如何获得当前正在进行的 SCNAction 的剩余持续时间?

How can I get the remaining duration of an SCNAction currently in progress?

NodeA 有一个 SCNAction 运行 持续时间为 10 秒。 假设 4 秒过去了。 如何获得正在进行的 SCNAction 的剩余持续时间(在本例中为 6 秒)?

我计划使用剩余的持续时间动态创建另一个 SCNAction,总计 10 秒。

所以NodeA动作时长+NodeB动作时长=10。

如果你想操纵elapsedTime,你应该使用SCNAction.customAction,例如:

let runningAction = SCNAction.customAction(duration: 10) { (node, elapsedTime) -> () in 
  // do stuff here with elapsedTime
  print(elapsedTime)
}

When the action executes, SceneKit calls the block repeatedly until the action’s duration expires. For each call, SceneKit computes the elapsed time and passes it to the block

文档 here