{"route":"/en-US-v0.13.1/reference/visualize/path/","title":"Path","description":"Documentation for the `path` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-fill","name":"fill","children":[]},{"id":"parameters-fill-rule","name":"fill-rule","children":[]},{"id":"parameters-stroke","name":"stroke","children":[]},{"id":"parameters-closed","name":"closed","children":[]},{"id":"parameters-vertices","name":"vertices","children":[]}]}],"body":{"kind":"func","content":{"path":[],"name":"path","title":"Path","keywords":[],"oneliner":"A path through a list of points, connected by Bézier curves.","element":true,"contextual":false,"deprecation":"the `path` function is deprecated, use `curve` instead","details":"<p>A path through a list of points, connected by Bézier curves.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">path</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> blue<span class=\"typ-punct\">.</span><span class=\"typ-func\">lighten</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">80%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  stroke<span class=\"typ-punct\">:</span> blue<span class=\"typ-punct\">,</span>\n  closed<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">0pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">100%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">50%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span> <span class=\"typ-punct\">(</span><span class=\"typ-num\">40pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/7c71fff7477a30492c8c5421fe00a40f.png\" alt=\"Preview\"></div></div>","example":null,"self":false,"params":[{"name":"fill","details":"<p>How to fill the path.</p>\n<p>When setting a fill, the default stroke disappears. To create a\nrectangle with both fill and stroke, you have to configure both.</p>","example":null,"types":["none","color","gradient","tiling"],"strings":[],"default":"<code><span class=\"typ-key\">none</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"fill-rule","details":"<p>The drawing rule used to fill the path.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-comment\">// We use `.with` to get a new</span>\n<span class=\"typ-comment\">// function that has the common</span>\n<span class=\"typ-comment\">// arguments pre-applied.</span>\n<span class=\"typ-key\">#</span><span class=\"typ-key\">let</span> star <span class=\"typ-op\">=</span> path<span class=\"typ-punct\">.</span><span class=\"typ-func\">with</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> red<span class=\"typ-punct\">,</span>\n  closed<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">25pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">10pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">50pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">20pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">0pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">20pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n  <span class=\"typ-punct\">(</span><span class=\"typ-num\">40pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span>\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">star</span><span class=\"typ-punct\">(</span>fill-rule<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;non-zero&quot;</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">star</span><span class=\"typ-punct\">(</span>fill-rule<span class=\"typ-punct\">:</span> <span class=\"typ-str\">&quot;even-odd&quot;</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/30910e51feb697b68ad0f1be1e5dc72a.png\" alt=\"Preview\"></div></div>","types":["str"],"strings":[{"string":"non-zero","details":"<p>Specifies that &quot;inside&quot; is computed by a non-zero sum of signed edge crossings.</p>"},{"string":"even-odd","details":"<p>Specifies that &quot;inside&quot; is computed by an odd number of edge crossings.</p>"}],"default":"<code><span class=\"typ-str\">&quot;non-zero&quot;</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"stroke","details":"<p>How to <a href=\"/en-US-v0.13.1/reference/visualize/stroke/\" title=\"stroke\">stroke</a> the path. This can be:</p>\n<p>Can be set to  <code><span class=\"typ-key\">none</span></code> to disable the stroke or to <code><span class=\"typ-key\">auto</span></code> for a\nstroke of <code><span class=\"typ-num\">1pt</span></code> black if and if only if no fill is given.</p>","example":null,"types":["none","auto","length","color","gradient","stroke","tiling","dictionary"],"strings":[],"default":"<code><span class=\"typ-key\">auto</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"closed","details":"<p>Whether to close this path with one last Bézier curve. This curve will\ntake into account the adjacent control points. If you want to close\nwith a straight line, simply add one last point that's the same as the\nstart point.</p>","example":null,"types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">false</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"vertices","details":"<p>The vertices of the path.</p>\n<p>Each vertex can be defined in 3 ways:</p>\n<ul>\n<li>A regular point, as given to the <a href=\"/en-US-v0.13.1/reference/visualize/line/\" title=\"`line`\"><code>line</code></a> or <a href=\"/en-US-v0.13.1/reference/visualize/polygon/\" title=\"`polygon`\"><code>polygon</code></a> function.</li>\n<li>An array of two points, the first being the vertex and the second\nbeing the control point. The control point is expressed relative to\nthe vertex and is mirrored to get the second control point. The given\ncontrol point is the one that affects the curve coming <em>into</em> this\nvertex (even for the first point). The mirrored control point affects\nthe curve going out of this vertex.</li>\n<li>An array of three points, the first being the vertex and the next\nbeing the control points (control point for curves coming in and out,\nrespectively).</li>\n</ul>","example":null,"types":["array"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":true,"settable":false}],"returns":["content"],"scope":[]}}}