Line
Jump to navigation
Jump to search
Links |
---|
Instantiation | Frame:CreateLine()
|
Details
- A line requires at least a start point, an end point and a color texture.
- The methods from ScriptRegionResizing are inherited but don't work. For example calling
:GetNumPoints()
will result in an error and calling:SetSize()
will have no effect.
Example
Draws a diagonal red line with a default thickness of 4.
local l = UIParent:CreateLine()
l:SetColorTexture(1, 0, 0)
l:SetStartPoint("CENTER", -20, 20) -- start topleft
l:SetEndPoint("CENTER", 20, -20) -- end bottomright
Draws a triangle with differently colored lines.
local function DrawLine(r, g, b, x1, y1, x2, y2)
local line = UIParent:CreateLine()
line:SetColorTexture(r, g, b)
line:SetThickness(2)
line:SetStartPoint("CENTER", UIParent, x1, y1)
line:SetEndPoint("CENTER", UIParent, x2, y2)
end
DrawLine(1,0,0, 0,0, 0,40)
DrawLine(0,1,0, 0,40, 40,0)
DrawLine(0,0,1, 40,0, 0,0)
Methods
|
|
Collapse |
---|
|
Script Types
|