docs.unity3d.com
    Show / Hide Table of Contents

    Struct Keyframe<T>

    A pair containing an interpolation ratio and {T} value.

    Namespace: UnityEngine.Splines
    Syntax
    [Serializable]
    public struct Keyframe<T> : IComparable<Keyframe<T>>, IComparable<float>, IKeyframe
    Type Parameters
    Name Description
    T

    The type of data this keyframe stores.

    Constructors

    Keyframe(Single, T)

    Create a new Keyframe with interpolation ratio and value.

    Declaration
    public Keyframe(float t, T value)
    Parameters
    Type Name Description
    Single t

    Interpolation ratio.

    T value

    The value to store.

    Properties

    Time

    The interpolation ratio relative to a spline. How this value is interpolated depends on the PathIndexUnit specified by SplineData<T>.

    Declaration
    public float Time { get; set; }
    Property Value
    Type Description
    Single
    Implements
    IKeyframe.Time

    Value

    A value to store with this keyframe.

    Declaration
    public T Value { get; set; }
    Property Value
    Type Description
    T

    Methods

    CompareTo(Single)

    Compare keyframe Time values.

    Declaration
    public int CompareTo(float other)
    Parameters
    Type Name Description
    Single other

    An interpolation ratio to compare against.

    Returns
    Type Description
    Int32

    An integer less than 0 if other.Time is greater than Time, 0 if time values are equal, and greater than 0 when other.Time is less than Time.

    CompareTo(Keyframe<T>)

    Compare keyframe Time values.

    Declaration
    public int CompareTo(Keyframe<T> other)
    Parameters
    Type Name Description
    Keyframe<T> other

    The Keyframe to compare against.

    Returns
    Type Description
    Int32

    An integer less than 0 if other.Time is greater than Time, 0 if time values are equal, and greater than 0 when other.Time is less than Time.

    ToString()

    A summary of the keyframe time and value.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A summary of the keyframe time and value.

    Overrides
    ValueType.ToString()
    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