> ## Documentation Index
> Fetch the complete documentation index at: https://luau.limerence.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# CurveEditor

> A draggable response curve.

Also has everything from [ElementHandle](/ui/classes/element-handle).

A draggable curve. Points use `0..1` for x; the first point is always pinned to the left edge and the last to the right edge.

|                |                                                              |
| -------------- | ------------------------------------------------------------ |
| **Value type** | `{ CurvePoint }`, points in normalized `0..1` space          |
| **Created by** | [Section:AddCurveEditor](/ui/classes/section#addcurveeditor) |

## Creation

```luau theme={null}
section:AddCurveEditor(key, label, min, max, default?)
```

<ParamField path="min" type="number" required>
  Output range minimum used by `Sample`.
</ParamField>

<ParamField path="max" type="number" required>
  Output range maximum used by `Sample`.
</ParamField>

***

## SetXRange

```luau theme={null}
curve:SetXRange(xMin: number, xMax: number, suffix: string?): ()
```

Display range and units for the x axis. Affects `Sample` input mapping; doesn't move points.

***

## SetYSuffix

```luau theme={null}
curve:SetYSuffix(suffix: string): ()
```

Units shown on the y axis.

***

## SetHeight

```luau theme={null}
curve:SetHeight(pixels: number): ()
```

How tall the editor is (minimum 40).

***

## SetPoints

```luau theme={null}
curve:SetPoints(points: { CurvePoint }): ()
```

Replace all points. Values are clamped, sorted, and endpoints re-pinned.

***

## AddPoint

```luau theme={null}
curve:AddPoint(x: number, y: number): number?
```

Add a point. Returns its index, or `nil` if it couldn't be added.

***

## RemovePoint

```luau theme={null}
curve:RemovePoint(index: number): ()
```

Remove a point. The first and last can't be removed.

***

## MovePoint

```luau theme={null}
curve:MovePoint(index: number, x: number, y: number): ()
```

Endpoints keep `x` at `0` / `1`.

***

## Reset

```luau theme={null}
curve:Reset(preset: "linear" | "easeIn" | "easeOut" | "sCurve"?): ()
```

Reset to a preset. Defaults to `"linear"`.

***

## Sample

```luau theme={null}
curve:Sample(x: number): number
```

Get the curve's y at a given x. `x` is in your `SetXRange`, output is in `[min, max]`.

***

## SampleNormalized

```luau theme={null}
curve:SampleNormalized(t: number): number
```

Same as `Sample`, but `0..1` for both input and output. `GetValue` returns the point array.

## Example

```luau theme={null}
local curve = section:AddCurveEditor("falloff", "Falloff", 0, 1)
curve:SetXRange(0, 100, " studs")
curve:Reset("easeOut")
local y = curve:Sample(50)
```
