{"route":"/en-US-v0.14.1/reference/layout/scale/","title":"Scale","description":"Documentation for the `scale` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-factor","name":"factor","children":[]},{"id":"parameters-x","name":"x","children":[]},{"id":"parameters-y","name":"y","children":[]},{"id":"parameters-origin","name":"origin","children":[]},{"id":"parameters-reflow","name":"reflow","children":[]},{"id":"parameters-body","name":"body","children":[]}]}],"body":{"kind":"func","content":{"path":[],"name":"scale","title":"Scale","keywords":[],"oneliner":"Scales content without affecting layout.","element":true,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Scales content without affecting layout.</p>\n<p>Lets you mirror content by specifying a negative scale on a single axis.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">align</span><span class=\"typ-punct\">(</span>center<span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">scale</span><span class=\"typ-punct\">(</span>x<span class=\"typ-punct\">:</span> <span class=\"typ-op\">-</span><span class=\"typ-num\">100%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>This is mirrored.<span class=\"typ-punct\">]</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">scale</span><span class=\"typ-punct\">(</span>x<span class=\"typ-punct\">:</span> <span class=\"typ-op\">-</span><span class=\"typ-num\">100%</span><span class=\"typ-punct\">,</span> reflow<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>This is mirrored.<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/4a11fc3689aa86e118aeb7546c0a6368.png\" alt=\"Preview\"></div></div>"}],"self":false,"params":[{"name":"factor","details":[{"kind":"html","content":"<p>The scaling factor for both axes, as a positional argument. This is just\nan optional shorthand notation for setting <code>x</code> and <code>y</code> to the same\nvalue.</p>"}],"types":["auto","length","ratio"],"strings":[],"default":"<code><span class=\"typ-num\">100%</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"x","details":[{"kind":"html","content":"<p>The horizontal scaling factor.</p>\n<p>The body will be mirrored horizontally if the parameter is negative.</p>"}],"types":["auto","length","ratio"],"strings":[],"default":"<code><span class=\"typ-num\">100%</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"y","details":[{"kind":"html","content":"<p>The vertical scaling factor.</p>\n<p>The body will be mirrored vertically if the parameter is negative.</p>"}],"types":["auto","length","ratio"],"strings":[],"default":"<code><span class=\"typ-num\">100%</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"origin","details":[{"kind":"html","content":"<p>The origin of the transformation.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code>A<span class=\"typ-func\">#</span><span class=\"typ-func\">box</span><span class=\"typ-punct\">(</span><span class=\"typ-func\">scale</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">75%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>A<span class=\"typ-punct\">]</span><span class=\"typ-punct\">)</span>A <span class=\"typ-escape\">\\</span>\nB<span class=\"typ-func\">#</span><span class=\"typ-func\">box</span><span class=\"typ-punct\">(</span><span class=\"typ-func\">scale</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">75%</span><span class=\"typ-punct\">,</span> origin<span class=\"typ-punct\">:</span> bottom <span class=\"typ-op\">+</span> left<span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>B<span class=\"typ-punct\">]</span><span class=\"typ-punct\">)</span>B\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/753e3d1a1bca7e3f8a8ff37f29db41a9.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["alignment"],"strings":[],"default":"<code>center <span class=\"typ-op\">+</span> horizon</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"reflow","details":[{"kind":"html","content":"<p>Whether the scaling impacts the layout.</p>\n<p>If set to <code><span class=\"typ-key\">false</span></code>, the scaled content will be allowed to overlap\nother content. If set to <code><span class=\"typ-key\">true</span></code>, it will compute the new size of\nthe scaled content and adjust the layout accordingly.</p>"},{"kind":"example","content":{"body":"<div class=\"previewed-code\"><pre><code>Hello <span class=\"typ-func\">#</span><span class=\"typ-func\">scale</span><span class=\"typ-punct\">(</span>x<span class=\"typ-punct\">:</span> <span class=\"typ-num\">20%</span><span class=\"typ-punct\">,</span> y<span class=\"typ-punct\">:</span> <span class=\"typ-num\">40%</span><span class=\"typ-punct\">,</span> reflow<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>World<span class=\"typ-punct\">]</span>!\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/f2a115827e2953ff282e69617b8717d9.png\" alt=\"Preview\"></div></div>","title":null}}],"types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">false</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":true},{"name":"body","details":[{"kind":"html","content":"<p>The content to scale.</p>"}],"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]}}}