combine method

Merges this animation with other using composition rules.

Properties that compound (opacity, scale) are multiplied. Additive properties (translation, rotation, blur) are summed. Color and backgroundColor fall back to the last non-null value.

other — the CharacterAnimation to combine into this one.

Implementation

CharacterAnimation combine(CharacterAnimation other) {
  return CharacterAnimation(
    opacity: opacity * other.opacity,
    translation: translation + other.translation,
    scale: scale * other.scale,
    scaleX: scaleX * other.scaleX,
    scaleY: scaleY * other.scaleY,
    color: other.color ?? color,
    backgroundColor: other.backgroundColor ?? backgroundColor,
    blurSigma: blurSigma + other.blurSigma,
    rotation: rotation + other.rotation,
    rotationX: rotationX + other.rotationX,
    rotationY: rotationY + other.rotationY,
    underlineProgress: underlineProgress + other.underlineProgress,
    clipProgress: clipProgress * other.clipProgress,
    character: other.character ?? character,
  );
}