TriLib
Search Results for

    Show / Hide Table of Contents

    Class AnimationCurveExtensions

    Provides extension methods to facilitate working with UnityEngine.AnimationCurve objects.

    Inheritance
    object
    AnimationCurveExtensions
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: TriLibCore.Extensions
    Assembly: TriLibCore.dll
    Syntax
    public static class AnimationCurveExtensions

    Methods

    AddQuaternionKeyframe(AssetLoaderContext, AnimationCurve, AnimationCurve, AnimationCurve, AnimationCurve, Keyframe, Keyframe, Keyframe, Keyframe)

    Adds a new keyframe representing a UnityEngine.Quaternion to four separate UnityEngine.AnimationCurve objects (for X, Y, Z, and W), potentially simplifying by merging keyframes if the error falls below a certain threshold.

    Declaration
    public static void AddQuaternionKeyframe(AssetLoaderContext assetLoaderContext, AnimationCurve animationCurveX, AnimationCurve animationCurveY, AnimationCurve animationCurveZ, AnimationCurve animationCurveW, Keyframe keyframeX, Keyframe keyframeY, Keyframe keyframeZ, Keyframe keyframeW)
    Parameters
    Type Name Description
    AssetLoaderContext assetLoaderContext

    The AssetLoaderContext containing the AssetLoaderOptions which define thresholds and settings for simplification.

    AnimationCurve animationCurveX

    The UnityEngine.AnimationCurve for the X component.

    AnimationCurve animationCurveY

    The UnityEngine.AnimationCurve for the Y component.

    AnimationCurve animationCurveZ

    The UnityEngine.AnimationCurve for the Z component.

    AnimationCurve animationCurveW

    The UnityEngine.AnimationCurve for the W component.

    Keyframe keyframeX

    The keyframe for the X component.

    Keyframe keyframeY

    The keyframe for the Y component.

    Keyframe keyframeZ

    The keyframe for the Z component.

    Keyframe keyframeW

    The keyframe for the W component.

    AddVectorKeyframe(AnimationCurve, AssetLoaderContext, Keyframe, bool)

    Adds a new newKeyframe to the animationCurve representing a single component of a vector (e.g., x, y, or z position or scale). Potentially merges it with the previous keyframe if the error is below the defined threshold.

    Declaration
    public static void AddVectorKeyframe(this AnimationCurve animationCurve, AssetLoaderContext assetLoaderContext, Keyframe newKeyframe, bool isScale)
    Parameters
    Type Name Description
    AnimationCurve animationCurve

    The UnityEngine.AnimationCurve to which the keyframe will be added (or merged).

    AssetLoaderContext assetLoaderContext

    The AssetLoaderContext containing thresholds and other settings.

    Keyframe newKeyframe

    The new UnityEngine.Keyframe to be added or used to merge.

    bool isScale

    Indicates whether this keyframe represents a scale component. Determines whether ScaleThreshold or PositionThreshold is used.

    AutoClampedTangents(AnimationCurve)

    Automatically adjusts each key's tangents in the provided UnityEngine.AnimationCurve.

    If the value of a keyframe is outside the range defined by its neighboring keyframes, the in/out tangents for that key will be set to 0 (flat). Otherwise, an automatically computed tangent is assigned.

    Declaration
    public static void AutoClampedTangents(this AnimationCurve animationCurve)
    Parameters
    Type Name Description
    AnimationCurve animationCurve

    The UnityEngine.AnimationCurve whose key tangents will be adjusted.

    GetInTangentLinear(Keyframe, Keyframe)

    Calculates the linear in-tangent of the current thisKey based on a previous prevKey.

    Declaration
    public static float GetInTangentLinear(Keyframe thisKey, Keyframe prevKey)
    Parameters
    Type Name Description
    Keyframe thisKey

    The current keyframe.

    Keyframe prevKey

    The previous keyframe.

    Returns
    Type Description
    float

    The linear in-tangent value.

    GetOutTangentLinear(Keyframe, Keyframe)

    Calculates the linear out-tangent of the current thisKey based on the next nextKey.

    Declaration
    public static float GetOutTangentLinear(Keyframe nextKey, Keyframe thisKey)
    Parameters
    Type Name Description
    Keyframe nextKey

    The next keyframe.

    Keyframe thisKey

    The current keyframe.

    Returns
    Type Description
    float

    The linear out-tangent value.

    GetTangentAuto(Keyframe, Keyframe, Keyframe, int, int)

    Calculates an "auto" tangent for the current thisKey, given the previous and next keyframes.

    If index is 0 or the last key in count, then the tangent is returned as a linear out-tangent. Otherwise, an average slope is calculated.

    Declaration
    public static float GetTangentAuto(Keyframe nextKey, Keyframe prevKey, Keyframe thisKey, int index, int count)
    Parameters
    Type Name Description
    Keyframe nextKey

    The next keyframe.

    Keyframe prevKey

    The previous keyframe.

    Keyframe thisKey

    The current keyframe.

    int index

    The index of the current keyframe in the curve.

    int count

    The total number of keyframes in the curve.

    Returns
    Type Description
    float

    An automatically computed tangent value.

    SetTangents(AnimationCurve, TangentMode)

    Sets the tangents of the given UnityEngine.AnimationCurve to the specified mode.

    The first and last key tangents are set to 0 to ensure a smooth start/end. Intermediate keys are set based on the chosen TangentMode: Linear or Stepped.

    Declaration
    public static void SetTangents(this AnimationCurve animationCurve, TangentMode mode)
    Parameters
    Type Name Description
    AnimationCurve animationCurve

    The UnityEngine.AnimationCurve to modify.

    TangentMode mode

    The desired TangentMode.

    In this article
    Back to top Generated by DocFX