docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method lerp

    lerp(float, float, float)

    Returns the result of linearly interpolating from x to y using the interpolation parameter s.

    Declaration
    public static float lerp(float x, float y, float s)
    Parameters
    Type Name Description
    float x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float

    The interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(float2, float2, float)

    Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter s.

    Declaration
    public static float2 lerp(float2 x, float2 y, float s)
    Parameters
    Type Name Description
    float2 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float2 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float2

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(float3, float3, float)

    Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter s.

    Declaration
    public static float3 lerp(float3 x, float3 y, float s)
    Parameters
    Type Name Description
    float3 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float3 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float3

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(float4, float4, float)

    Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter s.

    Declaration
    public static float4 lerp(float4 x, float4 y, float s)
    Parameters
    Type Name Description
    float4 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float4 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float4

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(float2, float2, float2)

    Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter s.

    Declaration
    public static float2 lerp(float2 x, float2 y, float2 s)
    Parameters
    Type Name Description
    float2 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float2 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float2 s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float2

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(float3, float3, float3)

    Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter s.

    Declaration
    public static float3 lerp(float3 x, float3 y, float3 s)
    Parameters
    Type Name Description
    float3 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float3 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float3 s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float3

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(float4, float4, float4)

    Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter s.

    Declaration
    public static float4 lerp(float4 x, float4 y, float4 s)
    Parameters
    Type Name Description
    float4 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    float4 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    float4 s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    float4

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double, double, double)

    Returns the result of linearly interpolating from x to y using the interpolation parameter s.

    Declaration
    public static double lerp(double x, double y, double s)
    Parameters
    Type Name Description
    double x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double

    The interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double2, double2, double)

    Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter s.

    Declaration
    public static double2 lerp(double2 x, double2 y, double s)
    Parameters
    Type Name Description
    double2 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double2 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double2

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double3, double3, double)

    Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter s.

    Declaration
    public static double3 lerp(double3 x, double3 y, double s)
    Parameters
    Type Name Description
    double3 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double3 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double3

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double4, double4, double)

    Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter s.

    Declaration
    public static double4 lerp(double4 x, double4 y, double s)
    Parameters
    Type Name Description
    double4 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double4 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double4

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double2, double2, double2)

    Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter s.

    Declaration
    public static double2 lerp(double2 x, double2 y, double2 s)
    Parameters
    Type Name Description
    double2 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double2 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double2 s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double2

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double3, double3, double3)

    Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter s.

    Declaration
    public static double3 lerp(double3 x, double3 y, double3 s)
    Parameters
    Type Name Description
    double3 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double3 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double3 s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double3

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    lerp(double4, double4, double4)

    Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter s.

    Declaration
    public static double4 lerp(double4 x, double4 y, double4 s)
    Parameters
    Type Name Description
    double4 x

    The first endpoint, corresponding to the interpolation parameter value of 0.

    double4 y

    The second endpoint, corresponding to the interpolation parameter value of 1.

    double4 s

    The interpolation parameter. May be a value outside the interval [0, 1].

    Returns
    Type Description
    double4

    The componentwise interpolation from x to y.

    Remarks

    If the interpolation parameter is not in the range [0, 1], then this function extrapolates.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)