BlendedClipAnimator QML Type
BlendedClipAnimator 是一个组件,可提供对混合节点树的动画播放功能。更多内容...
| Import Statement: | import Qt3D.Animation 2.12 |
| In C++: | QBlendedClipAnimator |
| Inherits: | |
| Status: | Technology preview |
此类型处于技术预览阶段,可能会有变动。
属性
- blendTree : AbstractClipBlendNode
详细说明
实体(Entity)可以聚合一个 BlendedClipAnimator 实例,从而获得播放动画片段以及将计算出的动画值应用到 QObject 属性上的能力。
与从单个动画片段获取动画数据的ClipAnimator 不同,BlendedClipAnimator可以混合多个片段。动画数据是通过评估所谓的混合树(blend tree)获得的。 混合树是一种分层树结构,其中叶节点是封装动画片段(AbstractAnimationClip)的值节点;而内部节点则代表对操作数属性所指向的节点进行操作的混合运算。
要将混合树与 BlendedClipAnimator 关联,请将动画器的blendTree 属性设置为指向混合树的根节点:
BlendedClipAnimator {
blendTree: AdditiveClipBlend {
....
}
}混合树可以由以下节点类型构建:
注意: 仅当动画器未运行时,才应编辑混合节点树。
- Qt3D.Animation.ClipBlendValue
- Qt3D.Animation.LerpClipBlend
- Qt3D.Animation.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 是加法因子,beta 是线性插值混合因子),我们可以得到一组可能的二维连续动画:
(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
该属性保存了动画混合树的根节点,该节点将在动画器进行插值计算之前被评估。
© 2026 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.