Skip to content

Heck Animation Settings

Swifter edited this page Nov 5, 2024 · 1 revision

Animation Settings

An AnimationSettings object contains information about how an animation should be processed.

You can create one like so:

const animationSettings = new rm.AnimationSettings()

There are 2 properties you can set on it:

  • bakeSampleFrequency - If this animation is baked using the baking system, this is how many points to sample.

  • optimizer - This is an OptimizeSettings object for the animation. One is created automatically for you.

Optimizer

When an animation is "optimized", it is essentially trying to remove as many points as possible that don't contribute to the final look of the animation too much.

An OptimizeSettings object describes how the animation should be optimized.

You can create one like so:

const optimizeSettings = new rm.OptimizeSettings()

There are a couple properties you can set on it:

  • disabled - Whether the optimizer is bypassed.
  • performanceLog - Whether to log the percentage of points that were removed by the optimizer.
  • optimizeDuplicates - Whether to run an optimize function that removes adjacent points that have the same value.
  • optimizeSimilarPoints - An object that has options for an optimize function that removes points that are similar in value to each other.
{
    active: true,
    differenceThreshold: 1,
    timeDifferenceThreshold: 0.001
}
  • optimizeSimilarPointsSlope - An object that has options for an optimize function that removes points that are not contributing to the path of the animation.

alt text

{
    active: true,
    differenceThreshold: 0.03,
    timeDifferenceThreshold: 0.025,
    yInterceptDifferenceThreshold: 0.5
}

Optimize Functions

OptimizeFunctions are functions that run on each point in an animation and determine whether it should be kept.

Since we are typically not trying to remove the edge-most points, it is run only on the points between the first and last point. *Unless there are only 2 points, than it's run on the last one.

It gets information about the left point, current point, and right point if the animation size is greater than 2.

If the point is supposed to be removed, return it.

(
    pointA: rm.PointInfo,
    pointB: rm.PointInfo,
    pointC: rm.PointInfo | undefined,
) => rm.PointInfo | undefined

PointInfo is an object that contains information about the point it represents.

{
    readonly values: ReadonlyArray<number>
    readonly time: number
    readonly hasFlags: boolean
    readonly original: InnerPointBoundless
}

Clone this wiki locally