rojo/.cursor/rules/roblox/reference/engine/classes/Path2D.yaml
2026-02-02 12:08:47 -06:00

478 lines
13 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Path2D
type: class
memory_category: Instances
summary: ''
description: |
`Path2D` is a UI instance that represents a 2D spline. It can be placed under
any `Class.GuiObject` and be edited directly in the viewport using built‑in
tooling. `Path2D` stores control points and exposes methods to sample
positions along the curve, enabling curved UI layouts, path‑based animations,
and interactive tools like graph editors and visual effects.
See the [2D paths](../../../ui/2D-paths.md) guide for more information and
usage examples.
code_samples: []
inherits:
- GuiBase
descendants: []
tags: []
deprecation_message: ''
properties:
- name: Path2D.Closed
summary: |
Connects the first and last control points when enabled.
description: |
Connects the first and last control points when enabled.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: Path2D.Color3
summary: |
Determines the color of the `Class.Path2D`.
description: |
Determines the color of the `Class.Path2D`.
code_samples: []
type: Color3
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: Path2D.SelectedControlPoint
summary: |
Index of the currently selected `Datatype.Path2DControlPoint`.
description: |
Index of the currently selected `Datatype.Path2DControlPoint`.
code_samples: []
type: int
tags:
- NotReplicated
deprecation_message: ''
security:
read: RobloxScriptSecurity
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Control Points
serialization:
can_load: true
can_save: false
capabilities:
- UI
- name: Path2D.SelectedControlPointData
summary: |
`Datatype.Path2DControlPoint` data type representing the currently
selected control point.
description: |
`Datatype.Path2DControlPoint` data type representing the currently
selected control point, if any.
code_samples: []
type: Path2DControlPoint
tags:
- NotReplicated
deprecation_message: ''
security:
read: RobloxScriptSecurity
write: RobloxScriptSecurity
thread_safety: ReadSafe
category: Control Points
serialization:
can_load: true
can_save: false
capabilities:
- UI
- name: Path2D.Thickness
summary: |
Determines how thick the `Class.Path2D` path is.
description: |
Determines how thick the `Class.Path2D` path is.
code_samples: []
type: float
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: Path2D.Visible
summary: |
Determines if the `Class.Path2D` path is rendered or not.
description: |
Determines if the `Class.Path2D` path is rendered or not. When `false`,
the path will not render. However, any modifications to the control points
will update correctly, ensuring that querying data will have the correct
info.
code_samples: []
type: boolean
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
- name: Path2D.ZIndex
summary: |
Determines the order in which a `Class.Path2D` path renders relative to
other GUIs.
description: |
Determines the order in which a `Class.Path2D` path renders relative to
other GUIs. Works the same as `Class.GuiObject.ZIndex` but does not
interact with layout order in any way.
code_samples: []
type: int
tags: []
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: true
can_save: true
capabilities:
- UI
methods:
- name: Path2D:GetBoundingRect
summary: |
Returns the bounding size for the `Class.Path2D`.
description: |
Returns the `Datatype.Rect` bounding size for the `Class.Path2D`. This is
computed based on the control points and is not modifiable outside of
changing the control point data.
code_samples: []
parameters: []
returns:
- type: Rect
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetControlPoint
summary: |
Returns the `Datatype.Path2DControlPoint` for a given index.
description: |
Returns the `Datatype.Path2DControlPoint` for a given index. If the index
is out of bounds, this method will throw an error.
code_samples: []
parameters:
- name: index
type: int
default:
summary: ''
returns:
- type: Path2DControlPoint
summary: |
The control point at the given index.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetControlPoints
summary: |
Returns all the `Datatype.Path2DControlPoint|Path2DControlPoints` for the
`Class.Path2D`.
description: |
Returns a table of all the
`Datatype.Path2DControlPoint|Path2DControlPoints` for the `Class.Path2D`.
code_samples: []
parameters: []
returns:
- type: Array
summary: |
Table of all the `Datatype.Path2DControlPoint|Path2DControlPoints`.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetLength
summary: |
Returns the length of the `Class.Path2D`.
description: |
Returns the length of the `Class.Path2D`. This function can be expensive
if called too frequently.
code_samples: []
parameters: []
returns:
- type: float
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetMaxControlPoints
summary: |
Returns the maximum allowed number of control points.
description: |
Returns the maximum allowed number of control points.
code_samples: []
parameters: []
returns:
- type: int
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetPositionOnCurve
summary: |
Returns the position at a given value in parameter space.
description: |
Returns the 2D `Datatype.UDim2` position at a given `t` value between `0`
and `1` (inclusive), representing the parameter space result of querying
the spline. The values will be more tightly packed near bends and wider
apart in straighter segments; see
`Class.Path2D:GetPositionOnCurveArcLength()|GetPositionOnCurveArcLength()`
for even spacing results.
Throws an error if the `Class.Path2D` has less than two control points.
code_samples: []
parameters:
- name: t
type: float
default:
summary: |
The value to query the `Class.Path2D` at.
returns:
- type: UDim2
summary: |
The position in parameter space.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetPositionOnCurveArcLength
summary: |
Returns the position at a given value in arc length space.
description: |
Returns the 2D `Datatype.UDim2` position at a given `t` value between `0`
and `1` (inclusive), representing the arc length space result of querying
the spline. The values will be evenly spaced along the spline; see
`Class.Path2D:GetPositionOnCurve()|GetPositionOnCurve()` for parameter
spacing results.
Throws an error if the `Class.Path2D` has less than two control points.
code_samples: []
parameters:
- name: t
type: float
default:
summary: |
The value to query the Path2D at.
returns:
- type: UDim2
summary: |
The position in arc length space.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetTangentOnCurve
summary: |
Returns the tangent at a given value in parameter space.
description: |
Returns the tangent at a given `t` value in parameter space where `t` is a
value between `0` and `1` (inclusive). Throws an error if the
`Class.Path2D` has less than two control points.
code_samples: []
parameters:
- name: t
type: float
default:
summary: |
The value to query the `Class.Path2D` at.
returns:
- type: Vector2
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:GetTangentOnCurveArcLength
summary: |
Returns the tangent at a given value in arc length space.
description: |
Returns the tangent at a given `t` value in arc length space where `t` is
a value between `0` and `1` (inclusive). Throws an error if the
`Class.Path2D` has less than two control points.
code_samples: []
parameters:
- name: t
type: float
default:
summary: |
The value to query the `Class.Path2D` at.
returns:
- type: Vector2
summary: |
The tangent in arc length space.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:InsertControlPoint
summary: |
Inserts a new control point at a given index.
description: |
Inserts a new `Datatype.Path2DControlPoint` at a given index. Throws a
warning if the index is out of bounds or if you're trying to add control
points past the limit of 50.
code_samples: []
parameters:
- name: index
type: int
default:
summary: |
The index to insert at.
- name: point
type: Path2DControlPoint
default:
summary: |
The control point to insert.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:RemoveControlPoint
summary: |
Removes a control at the given index.
description: |
Removes a control point at the given index. Throws a warning if the index
is out of bounds.
code_samples: []
parameters:
- name: index
type: int
default:
summary: |
The index to remove at.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:SetControlPoints
summary: |
Sets all the control points to the specified array, replacing all existing
points with new ones.
description: |
Sets all the control points to the specified array, replacing all existing
points with new ones. Throws a warning if there are more than 50 points in
the `controlPoints` array.
code_samples: []
parameters:
- name: controlPoints
type: Array
default:
summary: |
The new list of control points to set.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
- name: Path2D:UpdateControlPoint
summary: |
Updates a control point at the given index.
description: |
Updates the control point at the given index. Throws a warning if the
index is out of range.
code_samples: []
parameters:
- name: index
type: int
default:
summary: |
The control point index to update.
- name: point
type: Path2DControlPoint
default:
summary: ''
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- UI
events:
- name: Path2D.ControlPointChanged
summary: |
Fires any time control points change.
description: |
Fires any time control points change.
code_samples: []
parameters: []
tags: []
deprecation_message: ''
security: None
capabilities:
- UI
callbacks: []