如何在 SceneKit 中的两个独立动画之间平滑过渡?
How can I smoothly transition between two separate animations in SceneKit?
我正在使用一个 3d 模型,每个动画有一个 CAAnimationGroup,每个组包含 SCNMorpher 权重动画,每帧有 2 个 CABasicAnimations(为每一帧和下一帧从 1.0 到 0.0 和 0.0 到 1.0 的权重过渡使用插值法)。
我的动画 运行 流畅,但是从一组到下一组的过渡是粗糙和僵硬的,就像从走路到 运行。
我是 3D 模型动画的新手,需要一些关于 SceneKit 方法的指导,以构建从任何动画到下一个动画的平滑过渡。
我希望能够立即停止当前的 运行 动画,无论它播放多远并立即过渡到下一个。我想过渡到目标动画中的偏移量,以确保目标动画保持其原始长度,以便动画音频同步不受影响。
由于我不确定回答问题需要哪些信息,因此我为信息不足提前致歉。如果你问,我会提供任何需要的信息。
如何在不等待当前 运行 动画完成并且不更改目标的 运行 持续时间的情况下从一个动画平滑过渡到另一个动画?
-removeAnimationForKey:fadeOutDuration:
有帮助吗?
来自文档:
For example, the geometry loaded from a scene file for a game character may have associated animations for player actions such as walking and jumping. When the player lands from a jump, you remove the jump animation so the character continues walking. If you use the removeAnimationForKey: method to remove the jump animation, SceneKit abruptly switches from the current frame of the jump animation to the current frame of the walk animation. If you use the removeAnimationForKey:fadeOutDuration: method instead, SceneKit plays both animations at once during that duration and interpolates vertex positions from one animation to the other, creating a smooth transition.
自 macOS_10.13
/iOS_11
以来,removeAnimation(forKey:fadeOutDuration:)
已弃用 实例方法。
func removeAnimation(forKey key: String,
fadeOutDuration duration: CGFloat)
Use new instance method removeAnimation(forKey:blendOutDuration:)
instead.
func removeAnimation(forKey key: String,
blendOutDuration duration: CGFloat)
我正在使用一个 3d 模型,每个动画有一个 CAAnimationGroup,每个组包含 SCNMorpher 权重动画,每帧有 2 个 CABasicAnimations(为每一帧和下一帧从 1.0 到 0.0 和 0.0 到 1.0 的权重过渡使用插值法)。
我的动画 运行 流畅,但是从一组到下一组的过渡是粗糙和僵硬的,就像从走路到 运行。
我是 3D 模型动画的新手,需要一些关于 SceneKit 方法的指导,以构建从任何动画到下一个动画的平滑过渡。
我希望能够立即停止当前的 运行 动画,无论它播放多远并立即过渡到下一个。我想过渡到目标动画中的偏移量,以确保目标动画保持其原始长度,以便动画音频同步不受影响。
由于我不确定回答问题需要哪些信息,因此我为信息不足提前致歉。如果你问,我会提供任何需要的信息。
如何在不等待当前 运行 动画完成并且不更改目标的 运行 持续时间的情况下从一个动画平滑过渡到另一个动画?
-removeAnimationForKey:fadeOutDuration:
有帮助吗?
来自文档:
For example, the geometry loaded from a scene file for a game character may have associated animations for player actions such as walking and jumping. When the player lands from a jump, you remove the jump animation so the character continues walking. If you use the removeAnimationForKey: method to remove the jump animation, SceneKit abruptly switches from the current frame of the jump animation to the current frame of the walk animation. If you use the removeAnimationForKey:fadeOutDuration: method instead, SceneKit plays both animations at once during that duration and interpolates vertex positions from one animation to the other, creating a smooth transition.
自 macOS_10.13
/iOS_11
以来,removeAnimation(forKey:fadeOutDuration:)
已弃用 实例方法。
func removeAnimation(forKey key: String,
fadeOutDuration duration: CGFloat)
Use new instance method
removeAnimation(forKey:blendOutDuration:)
instead.
func removeAnimation(forKey key: String,
blendOutDuration duration: CGFloat)