Skip to content

Shape ​

Путь подключения: require "ProjectMotionUI/Components/Shape"


Класс PMUI.Shape ​

Наследуется от: PMUI.BaseElement

Методы и функции ​

PMUI.Shape:new(presetOrParts) ​

Creates a shape from a preset or a custom collection of rectangular parts.

ПараметрТипОписание
presetOrPartsstring|table|nilPreset name or an array of normalized shape parts.

Returns: PMUI.Shape

PMUI.Shape:SetPreset(presetName) ​

Replaces the current shape parts with the specified preset. Unknown preset names result in an empty shape.

ПараметрТипОписание
presetNamestringName of a preset from PMUI.ShapePresets.

Returns: PMUI.Shape

PMUI.Shape:SetColor(r, g, b, a) ​

Sets the default fill color used by shape parts without an individual color.

ПараметрТипОписание
rnumberRed component (0.0-1.0).
gnumberGreen component (0.0-1.0).
bnumberBlue component (0.0-1.0).
anumber|nilAlpha component (0.0-1.0), defaults to 1.0.

Returns: PMUI.Shape

PMUI.Shape:AddPart(nx, ny, nw, nh, customColor) ​

Adds a rectangular part to the shape. Coordinates and dimensions are normalized relative to the element size.

ПараметрТипОписание
nxnumberHorizontal position (0.0-1.0).
nynumberVertical position (0.0-1.0).
nwnumberRelative width (0.0-1.0).
nhnumberRelative height (0.0-1.0).
customColortable|nilOptional color override for this part.

Returns: PMUI.Shape

PMUI.Shape:ClearParts() ​

Removes all parts from the shape.

Returns: PMUI.Shape

PMUI.Shape:prerender() ​

Renders all shape parts as scaled rectangles. Each part can use its own color or inherit the shape's default fill color.