# Path2D

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [GuiBase](https://rapi.sleaze.dev/classes/GuiBase.md), [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/Path2D/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Path2D

Represents a 2D cubic spline path that renders a stroked curve under any [`GuiObject`](https://rapi.sleaze.dev/classes/GuiObject.md).

## Properties

### SelectedControlPoint

```luau
Path2D.SelectedControlPoint: number = 1
```

- Tags: Not replicated, Roblox script security, Read capabilities: UI, Load only

Index of the currently selected [`Path2DControlPoint`](https://rapi.sleaze.dev/index/types/Path2DControlPoint.md).

### SelectedControlPointData

```luau
Path2D.SelectedControlPointData: Path2DControlPoint
```

- Tags: Not replicated, Roblox script security, Read capabilities: UI, Load only

[`Path2DControlPoint`](https://rapi.sleaze.dev/index/types/Path2DControlPoint.md) data type representing the currently selected control point.

### Closed

```luau
Path2D.Closed: boolean = false
```

- Tags: Read capabilities: UI

Connects the first and last control points when enabled.

### Color3

```luau
Path2D.Color3: Color3 = Color3.new(0, 0, 0)
```

- Tags: Read capabilities: UI

Determines the color of the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md).

### PropertiesSerialize

```luau
Path2D.PropertiesSerialize: string = ""
```

- Tags: Hidden, Not scriptable, Roblox script security, Read capabilities: UI

### Thickness

```luau
Path2D.Thickness: number = 1
```

- Tags: Read capabilities: UI

Determines how thick the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) path is.

### Transparency

```luau
Path2D.Transparency: number = 0
```

- Tags: Roblox script security, Read capabilities: UI

### Visible

```luau
Path2D.Visible: boolean = true
```

- Tags: Read capabilities: UI

Determines if the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) path is rendered or not.

### ZIndex

```luau
Path2D.ZIndex: number = 1
```

- Tags: Read capabilities: UI

Determines the order in which a [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) path renders relative to other GUIs.

## Methods

### GetBoundingRect

```luau
Path2D:GetBoundingRect(): Rect
```

- Tags: Capabilities: UI

Returns the bounding size for the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md).

Returns: The [`Rect`](https://rapi.sleaze.dev/index/types/Rect.md) bounding box that encloses the path, expanded by its rendered thickness.

### GetControlPoint

```luau
Path2D:GetControlPoint(index: number): Path2DControlPoint
```

- Tags: Capabilities: UI

Returns the [`Path2DControlPoint`](https://rapi.sleaze.dev/index/types/Path2DControlPoint.md) for a given index.

Parameters:

- `index`: The 1-based index of the control point to return.

Returns: The control point at the given index.

### GetControlPoints

```luau
Path2D:GetControlPoints(): { any }
```

- Tags: Capabilities: UI

Returns all the `Path2DControlPoints` for the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md).

Returns: Table of all the `Path2DControlPoints`.

### GetLength

```luau
Path2D:GetLength(): number
```

- Tags: Capabilities: UI

Returns the length of the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md).

Returns: The total length of the path.

### GetMaxControlPoints

```luau
Path2D:GetMaxControlPoints(): number
```

- Tags: Capabilities: UI

Returns the maximum allowed number of control points.

Returns: The maximum number of control points a [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) supports.

### GetPositionOnCurve

```luau
Path2D:GetPositionOnCurve(t: number): UDim2
```

- Tags: Capabilities: UI

Returns the position at a given value in parameter space.

Parameters:

- `t`: The value to query the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) at.

Returns: The position in parameter space.

### GetPositionOnCurveArcLength

```luau
Path2D:GetPositionOnCurveArcLength(t: number): UDim2
```

- Tags: Capabilities: UI

Returns the position at a given value in arc length space.

Parameters:

- `t`: The value to query the Path2D at.

Returns: The position in arc length space.

### GetSegmentCount

```luau
Path2D:GetSegmentCount(): number
```

- Tags: Roblox script security, Capabilities: UI

### GetTangentOnCurve

```luau
Path2D:GetTangentOnCurve(t: number): Vector2
```

- Tags: Capabilities: UI

Returns the tangent at a given value in parameter space.

Parameters:

- `t`: The value to query the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) at.

Returns: The tangent in parameter space.

### GetTangentOnCurveArcLength

```luau
Path2D:GetTangentOnCurveArcLength(t: number): Vector2
```

- Tags: Capabilities: UI

Returns the tangent at a given value in arc length space.

Parameters:

- `t`: The value to query the [`Path2D`](https://rapi.sleaze.dev/classes/Path2D.md) at.

Returns: The tangent in arc length space.

### InsertControlPoint

```luau
Path2D:InsertControlPoint(index: number, point: Path2DControlPoint)
```

- Tags: Capabilities: UI

Inserts a new control point at a given index.

Parameters:

- `index`: The index to insert at.
- `point`: The control point to insert.

### RemoveControlPoint

```luau
Path2D:RemoveControlPoint(index: number)
```

- Tags: Capabilities: UI

Removes a control at the given index.

Parameters:

- `index`: The index to remove at.

### SetControlPoints

```luau
Path2D:SetControlPoints(controlPoints: { any })
```

- Tags: Capabilities: UI

Sets all the control points to the specified array, replacing all existing points with new ones.

Parameters:

- `controlPoints`: The new list of control points to set.

### UpdateControlPoint

```luau
Path2D:UpdateControlPoint(index: number, point: Path2DControlPoint)
```

- Tags: Capabilities: UI

Updates a control point at the given index.

Parameters:

- `index`: The control point index to update.
- `point`: The new [`Path2DControlPoint`](https://rapi.sleaze.dev/index/types/Path2DControlPoint.md) value to store at the index.

## Events

### ControlPointChanged

```luau
Path2D.ControlPointChanged: RBXScriptSignal<()>
```

- Tags: Capabilities: UI

Fires any time control points change.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
