BlendedClipAnimator QML Type

BlendedClipAnimator is a component providing animation playback capabilities of a tree of blend nodes. 更多...

import 语句: import Qt3D.Animation 2.15
Since: Qt 5.9
实例化: QBlendedClipAnimator
继承:

AbstractClipAnimator

特性

详细描述

An instance of BlendedClipAnimator can be aggregated by an Entity to add the ability to play back animation clips and to apply the calculated animation values to properties of QObjects.

Whereas a ClipAnimator gets its animation data from a single animation clip, BlendedClipAnimator can blend together multiple clips. The animation data is obtained by evaluating a so called blend tree . A blend tree is a hierarchical tree structure where the leaf nodes are value nodes that encapsulate an animation clip (AbstractAnimationClip); and the internal nodes represent blending operations that operate on the nodes pointed to by their operand properties.

To associate a blend tree with a BlendedClipAnimator, set the animator's blendTree property to point at the root node of your blend tree:

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

A blend tree can be constructed from the following node types:

注意: The blend node tree should only be edited when the animator is not running.

Additional node types will be added over time.

As an example consider the following blend tree:

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

This can be created and used as follows:

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
}
					

By authoring a set of animation clips and blending between them dynamically at runtime with a blend tree, we open up a huge set of possible resulting animations. As some simple examples of the above blend tree, where alpha is the additive factor and beta is the lerp blend factor we can get a 2D continuum of possible animations:

(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
					

More complex blend trees offer even more flexibility for combining your animation clips. Note that the values used to control the blend tree (alpha and beta above) are simple properties on the blend nodes. This means, that these properties themselves can also be controlled by the animation framework.

特性文档编制

blendTree : AbstractClipBlendNode

This property holds the root of the animation blend tree that will be evaluated before being interpolated by the animator.