Class Spline | Post Processing | 2.3.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class Spline

    A wrapper on top of to handle zero-key curves and keyframe loops.

    Inheritance
    Object
    Spline
    Namespace: UnityEngine.Rendering.PostProcessing
    Syntax
    [Serializable]
    public sealed class Spline

    Constructors

    Spline(AnimationCurve, Single, Boolean, Vector2)

    Creates a new spline.

    Declaration
    public Spline(AnimationCurve curve, float zeroValue, bool loop, Vector2 bounds)
    Parameters
    Type Name Description
    AnimationCurve curve

    The animation curve to base this spline off

    Single zeroValue

    The value to return when the curve has no keyframe

    Boolean loop

    Should this curve loop?

    Vector2 bounds

    The curve bounds

    Fields

    cachedData

    An array holding pre-computed curve values.

    Declaration
    public float[] cachedData
    Field Value
    Type Description
    Single[]

    curve

    The underlying animation curve instance.

    Declaration
    public AnimationCurve curve
    Field Value
    Type Description
    AnimationCurve

    k_Precision

    Precision of the curve.

    Declaration
    public const int k_Precision = 128
    Field Value
    Type Description
    Int32

    k_Step

    The inverse of the precision of the curve.

    Declaration
    public const float k_Step = 0.0078125F
    Field Value
    Type Description
    Single

    Methods

    Cache(Int32)

    Caches the curve data at a given frame. The curve data will only be cached once per frame.

    Declaration
    public void Cache(int frame)
    Parameters
    Type Name Description
    Int32 frame

    A frame number

    Evaluate(Single)

    Evaluates the curve at a point in time.

    Declaration
    public float Evaluate(float t)
    Parameters
    Type Name Description
    Single t

    The time to evaluate

    Returns
    Type Description
    Single

    The value of the curve at time t

    Remarks

    Calling the length getter on a curve is expensive to it's better to cache its length and call Evaluate(Single, Int32) instead of getting the length for every call.

    Evaluate(Single, Int32)

    Evaluates the curve at a point in time.

    Declaration
    public float Evaluate(float t, int length)
    Parameters
    Type Name Description
    Single t

    The time to evaluate

    Int32 length

    The number of keyframes in the curve

    Returns
    Type Description
    Single

    The value of the curve at time t

    GetHashCode()

    Returns the computed hash code for this parameter.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A computed hash code

    Overrides
    Object.GetHashCode()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023