Difference between revisions of "Path2D"
From GiderosMobile
Line 29: | Line 29: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
− | [[Path2D.new]] ''<translate>Creates Path2D object</translate>''<br/> | + | [[Special:MyLanguage/Path2D.new|Path2D.new]] ''<translate>Creates Path2D object</translate>''<br/> |
− | [[Path2D:setConvex]] ''<translate>Flag the shape as convex.</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setConvex|Path2D:setConvex]] ''<translate>Flag the shape as convex.</translate>''<br/> |
− | [[Path2D:setFillColor]] ''<translate>Sets fill color</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setFillColor|Path2D:setFillColor]] ''<translate>Sets fill color</translate>''<br/> |
− | [[Path2D:setFontPath]] ''<translate>Sets the path from the outline of a TTFont character</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setFontPath|Path2D:setFontPath]] ''<translate>Sets the path from the outline of a TTFont character</translate>''<br/> |
− | [[Path2D:setLineColor]] ''<translate>Sets line color</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setLineColor|Path2D:setLineColor]] ''<translate>Sets line color</translate>''<br/> |
− | [[Path2D:setLineThickness]] ''<translate>Set the thickness of the outline</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setLineThickness|Path2D:setLineThickness]] ''<translate>Set the thickness of the outline</translate>''<br/> |
− | [[Path2D:setPath]] ''<translate>set path to draw</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setPath|Path2D:setPath]] ''<translate>set path to draw</translate>''<br/> |
− | [[Path2D:setSvgPath]] ''<translate>set path with svg properties</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setSvgPath|Path2D:setSvgPath]] ''<translate>set path with svg properties</translate>''<br/> |
− | [[Path2D:setTexture]] ''<translate>sets texture for fill</translate>''<br/> | + | [[Special:MyLanguage/Path2D:setTexture|Path2D:setTexture]] ''<translate>sets texture for fill</translate>''<br/> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
|} | |} |
Revision as of 16:35, 23 August 2018
Supported platforms:
Available since: Gideros 2016.04
Description
Draw quick 2D vector paths. This class aims at being a faster alternative to Shape for complex/curvy shapes.
Examples
Drawing Moon
--Moon
local p=Path2D.new()
local ms="MQQZ" --MoveTo, QuadTo, QuadTo, Close
local mp={100,0, -50,100, 100,200, 20,100, 100,0 }
p:setPath(ms,mp) --Set the path from a set of commands and coordinates
p:setLineThickness(3) -- Outline width
p:setFillColor(0xE0E0E0,0.7) --Fill color
p:setLineColor(0xC0C0C0) --Line color
p:setAnchorPosition(100,100)
stage:addChild(p)
Drawing banana
--Banana shape, SVG path format
local banana="M8.64,223.948c0,0,143.468,3.431,185.777-181.808c2.673-11.702-1.23-20.154,1.316-33.146h16.287c0,0-3.14,17.248,1.095,30.848c21.392,68.692-4.179,242.343-204.227,196.59L8.64,223.948z"
p=Path2D.new()
p:setSvgPath(banana) --Set the path from a SVG path description
p:setLineThickness(5) -- Outline width
p:setFillColor(0xFFFF80,0.7) --Fill color
p:setLineColor(0x404000) --Line color
p:setAnchorPosition(100,100)
stage:addChild(p)
MethodsPath2D.new Creates Path2D object |
EventsConstants |