RPE Chart Utils
    Preparing search index...

    Function keyframesToAnimatedVariable

    • 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.

      Parameters

      • keyframes: [
            number,
            number
            | number[],
            (
                | number
                | "linear"
                | "sineOut"
                | "sineIn"
                | "quadOut"
                | "quadIn"
                | "sineInOut"
                | "quadInOut"
                | "cubicOut"
                | "cubicIn"
                | "quartOut"
                | "quartIn"
                | "cubicInOut"
                | "quartInOut"
                | "quintOut"
                | "quintIn"
                | "expoOut"
                | "expoIn"
                | "circOut"
                | "circIn"
                | "backOut"
                | "backIn"
                | "circInOut"
                | "backInOut"
                | "elasticOut"
                | "elasticIn"
                | "bounceOut"
                | "bounceIn"
                | "bounceInOut"
            )?,
        ][]

        Sorted array of [beat, value, easing?] tuples (at least 2 entries).

      • easingType:
            | number
            | "linear"
            | "sineOut"
            | "sineIn"
            | "quadOut"
            | "quadIn"
            | "sineInOut"
            | "quadInOut"
            | "cubicOut"
            | "cubicIn"
            | "quartOut"
            | "quartIn"
            | "cubicInOut"
            | "quartInOut"
            | "quintOut"
            | "quintIn"
            | "expoOut"
            | "expoIn"
            | "circOut"
            | "circIn"
            | "backOut"
            | "backIn"
            | "circInOut"
            | "backInOut"
            | "elasticOut"
            | "elasticIn"
            | "bounceOut"
            | "bounceIn"
            | "bounceInOut" = 2

        Default easing type applied to segments without override (default: 2).

      • options: VariableEventOptions = {}

      Returns AnimatedVariable

      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]],
      ]);