A mathematic curve.
``````    public class Curve : Resource
``````

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

### Constructors

``````    public Curve()
``````

### Signals

``````    "range_changed" ()
``````

Emitted when MaxValue or MinValue is changed.

### Properties

``````    public object[] _Data { get; set; }
``````

``````    public int BakeResolution { get; set; }
``````

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

``````    public float MaxValue { get; set; }
``````

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

``````    public float MinValue { get; set; }
``````

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

### Methods

``````    public int AddPoint(Vector2 position, float leftTangent = 0f, float rightTangent = 0f, TangentMode leftMode = TangentMode.Free, TangentMode rightMode = TangentMode.Free)
``````

Adds a point to the curve. For each side, if the `*_mode` is `TANGENT_LINEAR`, the `*_tangent` angle (in degrees) uses the slope of the curve halfway to the adjacent point. Allows custom assignments to the `*_tangent` angle if `*_mode` is set to `TANGENT_FREE`.

``````    public void Bake()
``````

Recomputes the baked cache of points for the curve.

``````    public void CleanDupes()
``````

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

``````    public void ClearPoints()
``````

Removes all points from the curve.

``````    public int GetBakeResolution()
``````

Getter for BakeResolution

``````    public float GetMaxValue()
``````

Getter for MaxValue

``````    public float GetMinValue()
``````

Getter for MinValue

``````    public TangentMode GetPointLeftMode(int index)
``````

Returns the left `TangentMode` for the point at `index`.

``````    public float GetPointLeftTangent(int index)
``````

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

``````    public Vector2 GetPointPosition(int index)
``````

Returns the curve coordinates for the point at `index`.

``````    public TangentMode GetPointRightMode(int index)
``````

Returns the right `TangentMode` for the point at `index`.

``````    public float GetPointRightTangent(int index)
``````

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

``````    public float Interpolate(float offset)
``````

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

``````    public float InterpolateBaked(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.

``````    public void RemovePoint(int index)
``````

Removes the point at `index` from the curve.

``````    public void SetBakeResolution(int resolution)
``````

Setter for BakeResolution

``````    public void SetMaxValue(float max)
``````

Setter for MaxValue

``````    public void SetMinValue(float min)
``````

Setter for MinValue

``````    public void SetPointLeftMode(int index, TangentMode mode)
``````

Sets the left `TangentMode` for the point at `index` to `mode`.

``````    public void SetPointLeftTangent(int index, float tangent)
``````

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

``````    public int SetPointOffset(int index, float offset)
``````

Sets the offset from `0.5`

``````    public void SetPointRightMode(int index, TangentMode mode)
``````

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

``````    public void SetPointRightTangent(int index, float tangent)
``````

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

``````    public void SetPointValue(int index, float y)
``````

Assigns the vertical position `y` to the point at `index`.

### Inner Types

#### TangentMode

Name Value Description
Free 0 The tangent on this side of the point is user-defined.
Linear 1 The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.
ModeCount 2 The total number of available tangent modes.
Tags: