Sorted array of [beat, value, easing?] tuples (at least 2 entries).
Default easing type applied to segments without override (default: 2).
An AnimatedVariable.
// Ramp 'intensity' from 0 to 1 at beat 4, then back to 0 at beat 8
const anim = keyframesToAnimatedVariable([
[0, 0],
[4, 1],
[8, 0],
]);
// With per-segment easing override
const anim2 = keyframesToAnimatedVariable([
[0, 0],
[4, 1, 'cubicOut'], // Use cubicOut for 0→4
[8, 0], // Use default for 4→8
], 'linear');
// Animate a vec2 color parameter
const color = keyframesToAnimatedVariable([
[0, [255, 255, 255]],
[4, [255, 0, 0]],
]);
Create a multi-keyframe animated variable from an array of
[beat, value, easing?]tuples.Values are interpolated between consecutive keyframes using the specified easing. If a keyframe has a third element (number or string), it overrides the default easing for the segment starting from that keyframe. Both scalar (
number) and vector (number[]) values are supported.