Skip to content

[Feature] Animation blending #162

@vmarcella

Description

@vmarcella

Overview

Add the ability to blend between multiple animations for smooth transitions
and layered animation.

Current State

No response

Scope

Goals:

  • Crossfade between two animations
  • Blend by weight (0.0 to 1.0)
  • Additive blending (layer on top)
  • Blend over time (transition duration)

Non-Goals:

  • Animation state machine
  • Per-bone masking
  • Sync groups

Proposed API

pub struct AnimationBlender {
  animations: Vec<(AnimationPlayer, f32)>, // (player, weight)
}

impl AnimationBlender {
  pub fn new() -> Self;
  pub fn add(&mut self, player: AnimationPlayer, weight: f32);
  pub fn set_weight(&mut self, index: usize, weight: f32);
  pub fn crossfade(&mut self, from: usize, to: usize, duration: f32);
  pub fn update(&mut self, dt: f32);
  pub fn apply_to_pose(&self, skeleton: &Skeleton, pose: &mut Pose);
}

impl AnimationPlayer {
  pub fn blend_with(&self, other: &Self, factor: f32, pose: &mut Pose);
}

Acceptance Criteria

  • Two animations blend by weight
  • Weight 0.0 shows only first, 1.0 only second
  • Crossfade smoothly transitions
  • Additive blending layers effects
  • Weights can be animated over time

Affected Crates

lambda-rs

Notes

  • Blend transforms (position lerp, rotation slerp)
  • Normalize weights if they don't sum to 1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    animationAll things related to animationsenhancementNew feature or requestlambda-rsIssues pertaining to the core framework

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions