Difference between revisions of "Path2D:setSvgPath"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2016.04<br/>
'''<translate>Available since</translate>:''' Gideros 2016.04<br/>
+
'''Class:''' [[Path2D]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Path2D|Path2D]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate>Set path with svg properties in single string separated by comma (,)</translate>
+
Sets path with svg properties in single string separated by comma (,).
<source lang="lua">
+
<syntaxhighlight lang="lua">
Path2D:setSvgPath(svg_params)
+
Path2D:setSvgPath(svg_params)
</source>
+
</syntaxhighlight>
=== <translate>Parameters</translate> ===
+
 
'''svg_params''': (string) <translate>svg params separated by comma</translate> <br/>
+
=== Parameters ===
=== <translate>Examples</translate> ===
+
'''svg_params''': (string) svg params separated by comma<br/>
'''Drawing banana'''<br/>
+
 
<source lang="lua">--Banana shape, SVG path format
+
=== Example ===
 +
'''Drawing banana'''
 +
<syntaxhighlight lang="lua">
 +
--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"
 
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=Path2D.new()
Line 20: Line 23:
 
p:setLineColor(0x404000) --Line color
 
p:setLineColor(0x404000) --Line color
 
p:setAnchorPosition(100,100)
 
p:setAnchorPosition(100,100)
stage:addChild(p)</source>
+
stage:addChild(p)
 +
</syntaxhighlight>
 +
 
 +
{{Path2D}}

Latest revision as of 14:32, 13 July 2023

Available since: Gideros 2016.04
Class: Path2D

Description

Sets path with svg properties in single string separated by comma (,).

Path2D:setSvgPath(svg_params)

Parameters

svg_params: (string) svg params separated by comma

Example

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)