Curve

    Category: Core

    A mathematic curve.

    Properties

    Signals

    • range_changed ( )

    Emitted when or min_value is changed.

    enum TangentMode:

    • TANGENT_FREE = 0 — The tangent on this side of the point is user-defined.
    • TANGENT_MODE_COUNT = 2 — The total number of available tangent modes.

    Description

    A curve that can be saved and re-used for other objects. By default it ranges between and 1 on the y-axis and positions points relative to the 0.5 y-position.

    • bake_resolution

    The number of points to include in the baked (i.e. cached) curve data.


    The maximum value the curve can reach. Default value: 1.


    • min_value

    The minimum value the curve can reach. Default value: 0.

    Method Descriptions

    • int add_point ( position, float left_tangent=0, right_tangent=0, TangentMode left_mode=0, right_mode=0 )

    • void bake ( )

    Recomputes the baked cache of points for the curve.


    • void clean_dupes ( )

    Removes points that are closer than CMP_EPSILON (0.00001) units to their neighbor on the curve.


    • void clear_points ( )

    Removes all points from the curve.


    • int get_point_count ( ) const

    Returns the number of points describing the curve.


    • get_point_left_mode ( int index ) const

    Returns the left TangentMode for the point at .


    Returns the left tangent angle (in degrees) for the point at index.


    • get_point_position ( int index ) const

    Returns the curve coordinates for the point at index.


    • get_point_right_mode ( int index ) const

    Returns the right TangentMode for the point at index.


    • get_point_right_tangent ( int index ) const

    • interpolate ( float offset ) const

    Returns the y value for the point that would exist at x-position offset along the curve.


    • interpolate_baked ( float offset )

    Returns the y value for the point that would exist at x-position offset along the curve using the baked cache. Bakes the curve’s points if not already baked.


    • void remove_point ( index )

    Removes the point at index from the curve.


    • void set_point_left_mode ( int index, mode )

    Sets the left TangentMode for the point at index to .


    • void set_point_left_tangent ( int index, tangent )

    Sets the left tangent angle for the point at index to tangent.


    • int set_point_offset ( index, float offset )

    Sets the offset from 0.5


    Sets the right TangentMode for the point at index to mode.


    Sets the right tangent angle for the point at index to tangent.


    • void set_point_value ( index, float y )