BlendedClipAnimator QML Type

BlendedClipAnimator 是一个为混合节点树提供动画播放功能的组件。更多

Import Statement: import Qt3D.Animation 2.9
In C++: QBlendedClipAnimator
Inherits:

AbstractClipAnimator

Status: Deprecated

属性

详细说明

实体可以聚合 BlendedClipAnimator 的实例,以增加播放动画片段的功能,并将计算出的动画值应用到 QObject 的属性中。

ClipAnimator 从单个动画片段中获取动画数据,而 BlendedClipAnimator 可以将多个片段混合在一起。动画数据通过评估所谓的混合树获得。混合树是一种分层树结构,其中叶节点是封装动画片段(AbstractAnimationClip)的值节点;内部节点代表对操作数属性指向的节点进行操作的混合操作。

要将混合树与 BlendedClipAnimator 关联,请将动画播放器的blendTree 属性设置为指向混合树的根节点:

BlendedClipAnimator {
    blendTree: AdditiveClipBlend {
        ....
    }
}

混合树可以由以下节点类型构建:

注意: 混合节点树只能在动画播放器未运行时编辑。

其他节点类型将陆续添加。

举例来说,请看下面的混合树:

Clip0----
        |
        Lerp Node----
        |           |
Clip1----           Additive Node
                    |
            Clip2----

它的创建和使用方法如下:

BlendedClipAnimator {
    blendTree: AdditiveClipBlend {
        baseClip: LerpClipBlend {
            startClip: ClipBlendValue {
                clip: AnimationClipLoader { source: "walk.json" }
            }

            endClip: ClipBlendValue {
                clip: AnimationClipLoader { source: "run.json" }
            }
        }

        additiveClip: ClipBlendValue {
            clip: AnimationClipLoader { source: "wave-arm.json" }
        }
    }

    channelMapper: ChannelMapper {...}
    running: true
}

通过创建一组动画片段,并在运行时使用混合树在它们之间进行动态混合,我们可以获得大量可能的动画效果。在上述混合树的一些简单示例中,阿尔法是加法因子,贝塔是勒普混合因子,我们可以得到一个二维的连续动画:

(alpha = 0, beta = 1) Running, No arm waving --- (alpha = 1, beta = 1) Running, Arm waving
        |                                               |
        |                                               |
        |                                               |
(alpha = 0, beta = 0) Walking, No arm waving --- (alpha = 0, beta = 1) Running, No arm waving

更复杂的混合树为组合动画片段提供了更大的灵活性。请注意,用于控制混合树的值(上述 alpha 和 beta)是混合节点上的简单属性。这意味着这些属性本身也可由动画框架控制。

属性文档

blendTree : AbstractClipBlendNode

此属性用于保存动画混合树的根节点,动画师在对其进行插值之前将对其进行评估。


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.