Fudge Core
    Preparing search index...

    Class AnimationNodeBlend

    Blends multiple input AnimationNodes providing a blended mutator and the events from all nodes. Each child node must specify its own blend weight and blending. Processes nodes sequentially, each node blends with the accumulated result. When combined with AnimationNodeTransitions as children, transitions from/into an empty state will blend from/into the accumulated result of this node.

    Jonas Plotzky, HFU, 2024-2025

    Example walk-run-blend:

    import ƒ = FudgeCore;
    // initialization
    const walk: ƒ.Animation = new ƒ.Animation();
    const run: ƒ.Animation = new ƒ.Animation();
    const nodeWalk: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation(walk);
    const nodeRun: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation(run, { speed: run.totalTime / walk.totalTime }) // slow down the playback speed of run to synchronize the motion with walk.
    const nodeMove: ƒ.AnimationNodeBlend = new ƒ.AnimationNodeBlend([nodeWalk, nodeRun]);
    const cmpAnimationGraph: ƒ.ComponentAnimationGraph = new ƒ.ComponentAnimationGraph(); // get the animation component
    cmpAnimationGraph.root = nodeMove;

    // during the game
    nodeRun.weight = 0.5; // adjust the weight: 0 is walking, 1 is running.
    nodeMove.speed = 1 + nodeRun.weight * nodeRun.speed; // adjust the playback speed of the blend to account for the slowed down run animation.

    Example transition-empty-state:

    import ƒ = FudgeCore;
    // initialization
    const idle: ƒ.Animation = new ƒ.Animation();
    const walk: ƒ.Animation = new ƒ.Animation();
    const draw: ƒ.Animation = new ƒ.Animation();
    const sheathe: ƒ.Animation = new ƒ.Animation();

    const nodeEmpty: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation();
    const nodeIdle: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation(idle);
    const nodeWalk: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation(walk);
    const nodeDraw: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation(draw, { playmode: ƒ.ANIMATION_PLAYMODE.PLAY_ONCE });
    const nodeSheathe: ƒ.AnimationNodeAnimation = new ƒ.AnimationNodeAnimation(sheathe, { playmode: ƒ.ANIMATION_PLAYMODE.PLAY_ONCE });

    const nodeWholeBody: ƒ.AnimationNodeTransition = new ƒ.AnimationNodeTransition(nodeIdle);
    const nodeUpperBody: ƒ.AnimationNodeTransition = new ƒ.AnimationNodeTransition(nodeEmpty);
    const nodeRoot: ƒ.AnimationNodeBlend = new ƒ.AnimationNodeBlend([nodeWholeBody, nodeUpperBody]);
    const cmpAnimationGraph: ƒ.ComponentAnimationGraph = new ƒ.ComponentAnimationGraph(); // get the animation component
    cmpAnimationGraph.root = nodeRoot;

    // during the game
    nodeWholeBody.transit(nodeWalk, 300); // transit whole body into walk.
    // in parallel to the whole body, the upper body can transit from empty to draw/sheath and back to empty.
    nodeUpperBody.transit(nodeDraw, 300); // transit upper body from empty into draw.
    nodeUpperBody.transit(nodeSheathe, 300); // transit upper body from draw into sheathe.
    nodeUpperBody.transit(nodeEmpty, 300); // transit upper body from sheathe into empty.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    The mode used for blending this node with others in an AnimationNodeBlend. Default: ANIMATION_BLENDING.OVERRIDE.

    events: string[]

    The events that occured between the nodes last two updates.

    mutator: Mutator

    The (blended) animation mutator at the state of the last call to update.

    speed: number

    The playback speed

    weight: number

    The weight used for blending this node with others in an AnimationNodeBlend. Default: 1.

    Methods