[英]What is the equivalent of colorizing an object in SceneKit?
How can I animate a change in color of an SCNNode
? 如何设置
SCNNode
颜色的变化动画? In SpriteKit
I would just use the colorizeWithColor SKAction
, but that is not an option in SceneKit
. 在
SpriteKit
我只使用colorizeWithColor SKAction
,但这不是SceneKit
的选项。 In SpriteKit
, I would typically have a collision between two nodes. 在
SpriteKit
,我通常会在两个节点之间发生冲突。 When the nodes collided one of the nodes changed colors simply by running the colorizeWithColor SKAction
. 当节点冲突时,只需运行
colorizeWithColor SKAction
即可更改其中一个节点的颜色。 What's the equivalent of this in SceneKit
for an SCNNode
? SceneKit
的SCNNode
的等效功能是什么?
You can use the multiply
property of your material to achieve a similar effect. 您可以使用材质的
multiply
属性来达到类似的效果。 You can set the fade length with SCNTransaction
's animationDuration
property. 您可以使用
SCNTransaction
的animationDuration
属性设置淡入淡出的长度。
SCNTransaction.begin()
SCNTransaction.animationDuration = yourFadeDuration
geometry?.firstMaterial?.multiply.contents = yourDesiredColor
SCNTransaction.commit()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.