Overview
Creates a arrow shape.
Arrow class inherits Shape and Shape and Display classes, therefore all the methods defined in Shape and Display classes can also be used in the Arrow object.
Syntax
• num - (required) width of head of arrow
• option - (optional) table of extra parameters
{
strokeWidth = n, -- (optional) set width of stroke (default:0)
strokeColor = color, -- (optional) stroke color (Color object, default:Color.WHITE)
fill = color -- (optional) fill color (Color object, default:Color.WHITE)
headHeight = n, -- set height of arrow head
tailHeight = n, -- set height of arrow tail
tailWidth = n, -- set width of arrow tail
}
Note that the initial anchor point is the center of the arrow.
Note also that if the alpha of fill-color is 0, hollow arrow will be drawn.
Methods
methods inheritted from Shape class :
method | description | return |
obj:setStrokeWidth(n) | set width of outline | self |
obj:setStrokeColor(color) | set color of outline with Color object | self |
obj:fill(color) | set color of inner area with Color object | self |
obj:empty() | display stroke only | self |
Rect class methods :
method | description | return |
obj:setWidth(n) | reset the width of the arrow as n | self |
obj:setHeadHeight(n) | reset the height of the arrow head as n | self |
obj:setTailHeight(n) | reset the height of the arrow tail as n | self |
obj:setTailWidth(n) | reset the width of the arrow head as n | self |
obj:getWidth() | get width of the rectangle | number |
obj:getHeight() | get total height | number |
obj:getHeadHeight() | get height of the arrow head | number |
obj:getTailWidth() | get width of the arrow tail | number |
obj:getTailHeight() | get height of the arrow tail | number |
Examples
local arr = Arrow(50) -- square
local arr1 = Arrow(100,{fill=Color(255,0,0)}) -- or local arr1 = Arrow(100):fill(Color(255,0,0))
local arr2 = Arr(200,{strokeWidth=20, strokeColor=Color.RED, tailHeight=50})
-- later, change the height of arrow head of arr2 arr2:setHeadHeight(200) |
댓글 없음:
댓글 쓰기