Error[8]: Undefined offset: 5, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述我希望能够在SceneKit中一个接一个地运行多个动画.我已经实现了一个运行一个动画的函数: fileprivate func animateMove(_ move: Move) { print("Animate move started " + move.identifier) // I am creating rotateNode let rotateNode = S 我希望能够在SceneKit中一个接一个地运行多个动画.我已经实现了一个运行一个动画的函数:

fileprivate func animateMove(_ move: Move) {    print("Animate move started " + move.IDentifIEr)    // I am creating rotateNode    let rotateNode = SCNNode()    rotateNode.eulerAngles.x = CGfloat.pi    scene.rootNode.addChildNode(rotateNode)    // Then I am selecting nodes which I want to rotate    nodesToRotate = ...    // Then I am adding the nodes to rotate node    _ = nodesToRotate.map { rotateNode.addChildNode(
func animateMoves(_ moves: [Move]) {        for (index,move) in moves.enumerated() {            perform(#selector(animateMove(_:)),with: move,afterDelay: TimeInterval(Double(index) * move.duration)        }    }
) } SCNTransaction.begin() SCNTransaction.animationDuration = move.animationDuration SCNTransaction.completionBlock = { rotateNode.enumerateChildNodes { node,_ in node.transform = node.worldtransform node.removeFromparentNode() scene.rootNode.addChildNode(node) } rotateNode.removeFromparentNode() print("Animate move finished " + move.IDentifIEr) } SCNTransaction.commit()}

然后我尝试运行多个串行动画,如下所示:

Animate move started 1Animate move started 2Animate move finished 1Animate move finished 2Animate move started 3Animate move finished 3

一切都是动画,但动画不是以连续的方式运行.动画在不可预测的时间内开始和结束.
来自调试器的示例日志:

class func sequence([SCNAction])

我意识到我的方法不是最好的,但只有通过这种方式,我才能实现几乎可以工作的动画.

我知道有一个SCNAction类可用.也许我应该在一次交易中做出很多动作?如果是这样,有人可以向我解释SCNTransactions究竟是如何工作的以及SCNTransaction的完成块在不可预测的时间内完成的原因是什么?

解决方法 尝试使用SCNAction.sequence():

let sequence = SCNAction.sequence([action1,action2,action3]) // will be executed one by onelet node = SCNNode()node.runAction(sequence,completionHandler:nil)

创建一个按顺序运行 *** 作集合的 *** 作

[+++] 总结

以上是内存溢出为你收集整理的ios – SceneKit中的多个串口动画全部内容,希望文章能够帮你解决ios – SceneKit中的多个串口动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
ios – SceneKit中的多个串口动画_app_内存溢出

ios – SceneKit中的多个串口动画

ios – SceneKit中的多个串口动画,第1张

概述我希望能够在SceneKit中一个接一个地运行多个动画.我已经实现了一个运行一个动画的函数: fileprivate func animateMove(_ move: Move) { print("Animate move started " + move.identifier) // I am creating rotateNode let rotateNode = S 我希望能够在SceneKit中一个接一个地运行多个动画.我已经实现了一个运行一个动画的函数:

fileprivate func animateMove(_ move: Move) {    print("Animate move started " + move.IDentifIEr)    // I am creating rotateNode    let rotateNode = SCNNode()    rotateNode.eulerAngles.x = CGfloat.pi    scene.rootNode.addChildNode(rotateNode)    // Then I am selecting nodes which I want to rotate    nodesToRotate = ...    // Then I am adding the nodes to rotate node    _ = nodesToRotate.map { rotateNode.addChildNode(
func animateMoves(_ moves: [Move]) {        for (index,move) in moves.enumerated() {            perform(#selector(animateMove(_:)),with: move,afterDelay: TimeInterval(Double(index) * move.duration)        }    }
) } SCNTransaction.begin() SCNTransaction.animationDuration = move.animationDuration SCNTransaction.completionBlock = { rotateNode.enumerateChildNodes { node,_ in node.transform = node.worldtransform node.removeFromparentNode() scene.rootNode.addChildNode(node) } rotateNode.removeFromparentNode() print("Animate move finished " + move.IDentifIEr) } SCNTransaction.commit()}

然后我尝试运行多个串行动画,如下所示:

Animate move started 1Animate move started 2Animate move finished 1Animate move finished 2Animate move started 3Animate move finished 3

一切都是动画,但动画不是以连续的方式运行.动画在不可预测的时间内开始和结束.
来自调试器的示例日志:

class func sequence([SCNAction])

我意识到我的方法不是最好的,但只有通过这种方式,我才能实现几乎可以工作的动画.

我知道有一个SCNAction类可用.也许我应该在一次交易中做出很多动作?如果是这样,有人可以向我解释SCNTransactions究竟是如何工作的以及SCNTransaction的完成块在不可预测的时间内完成的原因是什么?

解决方法 尝试使用SCNAction.sequence():

let sequence = SCNAction.sequence([action1,action2,action3]) // will be executed one by onelet node = SCNNode()node.runAction(sequence,completionHandler:nil)

创建一个按顺序运行 *** 作集合的 *** 作

总结

以上是内存溢出为你收集整理的ios – SceneKit中的多个串口动画全部内容,希望文章能够帮你解决ios – SceneKit中的多个串口动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1073288.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存