Skip to content

@ue-too/animate / index / PointAnimationHelper

Class: PointAnimationHelper ​

Defined in: animatable-attribute.ts:103

Interface for type-specific interpolation helpers.

Remarks ​

Animation helpers provide the lerp (linear interpolation) logic for specific types. Different types require different interpolation strategies:

  • Numbers: Simple linear interpolation
  • Points: Component-wise interpolation
  • Colors (RGB): Component-wise color interpolation
  • Strings: Step-based (threshold) interpolation

Example ​

typescript
const myHelper: AnimatableAttributeHelper<number> = {
  lerp: (ratio, start, end) => {
    const t = (ratio - start.percentage) / (end.percentage - start.percentage);
    return start.value + t * (end.value - start.value);
  }
};

Implements ​

Constructors ​

Constructor ​

new PointAnimationHelper(): PointAnimationHelper

Defined in: animatable-attribute.ts:104

Returns ​

PointAnimationHelper

Methods ​

lerp() ​

lerp(ratio, start, end): Point

Defined in: animatable-attribute.ts:106

Interpolates between two keyframes at a given ratio.

Parameters ​

ratio ​

number

Current animation progress (0.0 to 1.0)

start ​

Keyframe<Point>

Starting keyframe

end ​

Keyframe<Point>

Ending keyframe

Returns ​

Point

Interpolated value at the given ratio

Implementation of ​

AnimatableAttributeHelper.lerp