Also has everything from ElementHandle.
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 |
Creation
section:AddCurveEditor(key, label, min, max, default?)
Output range minimum used by Sample.
Output range maximum used by Sample.
SetXRange
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
curve:SetYSuffix(suffix: string): ()
Units shown on the y axis.
SetHeight
curve:SetHeight(pixels: number): ()
How tall the editor is (minimum 40).
SetPoints
curve:SetPoints(points: { CurvePoint }): ()
Replace all points. Values are clamped, sorted, and endpoints re-pinned.
AddPoint
curve:AddPoint(x: number, y: number): number?
Add a point. Returns its index, or nil if it couldn’t be added.
RemovePoint
curve:RemovePoint(index: number): ()
Remove a point. The first and last can’t be removed.
MovePoint
curve:MovePoint(index: number, x: number, y: number): ()
Endpoints keep x at 0 / 1.
Reset
curve:Reset(preset: "linear" | "easeIn" | "easeOut" | "sCurve"?): ()
Reset to a preset. Defaults to "linear".
Sample
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
curve:SampleNormalized(t: number): number
Same as Sample, but 0..1 for both input and output. GetValue returns the point array.
Example
local curve = section:AddCurveEditor("falloff", "Falloff", 0, 1)
curve:SetXRange(0, 100, " studs")
curve:Reset("easeOut")
local y = curve:Sample(50)