Back to Plugins
Really Flatten Vectors

Really Flatten Vectors

<p>Figma plugin that flattens a vector into as few paths as possible. Overlapping paths will be simplified so only the outer shape is defined. The flattening happens in-place.</p><h2><br></h2><h2>Usage</h2><ol><li>Select some layers</li><li>Run the plugin by going to&nbsp;<code>Plugins &gt; Really Flatten Vectors</code>&nbsp;or pressing&nbsp;<code>⌘/</code>&nbsp;and searching for&nbsp;<code>Really Flatten Vectors</code>.</li></ol><p><br></p><h2><strong>Links</strong></h2><ul><li><a href="https://github.com/stevenla/figma-plugin-really-flatten-vector" rel="noreferrer noopener nofollow ugc" target="_blank">GitHub</a></li><li><a href="https://steven.la/" rel="noreferrer noopener nofollow ugc" target="_blank">Personal Site</a></li></ul><p><br></p><h2>Known Issues</h2><ul><li>Flattening inside of a group/frame with auto-layout will not flatten in-place</li><li>Some invisible layers will be made visible</li></ul><p><br></p><h2>How does it work?</h2><p>Generally, Figma simplifies paths when using the built-in flatten&nbsp;<code>⌘E</code>&nbsp;on a union layer. This plugin simplifies the setup needed to get a pretty flattened output.</p><ol><li>Deeply ungroup/unframe the selection. This keeps positioning simple for some of the later operations.</li><li>Outline all strokes. Since this plugin merges everything into one path, strokes cannot be preserved. All strokes and text are outlined.</li><li>Use the first valid fill paint data to use as the output fill.</li><li>Use Figma's built-in flatten to merge the layers. Figma is pretty intelligent and will place the resulting layer in the correct spot in the layer hierarchy.</li><li>Create a union layer that contains the resulting layer from the previous step, and a clone of that same layer. This is because running the built-in flatten on a union with just one layer won't simplify the paths. If there is an exact replica inside the union, then the resulting layer will have simplified paths.</li><li>Run the built-in flatten against the union.</li></ol><h2><br></h2>

illustrationsflattensimplifymergeiconsvectorunion

Plugin Preview

Really Flatten Vectors preview

About this plugin

Figma plugin that flattens a vector into as few paths as possible. Overlapping paths will be simplified so only the outer shape is defined. The flattening happens in-place.


Usage

  1. Select some layers
  2. Run the plugin by going to Plugins > Really Flatten Vectors or pressing ⌘/ and searching for Really Flatten Vectors.


Links


Known Issues

  • Flattening inside of a group/frame with auto-layout will not flatten in-place
  • Some invisible layers will be made visible


How does it work?

Generally, Figma simplifies paths when using the built-in flatten ⌘E on a union layer. This plugin simplifies the setup needed to get a pretty flattened output.

  1. Deeply ungroup/unframe the selection. This keeps positioning simple for some of the later operations.
  2. Outline all strokes. Since this plugin merges everything into one path, strokes cannot be preserved. All strokes and text are outlined.
  3. Use the first valid fill paint data to use as the output fill.
  4. Use Figma's built-in flatten to merge the layers. Figma is pretty intelligent and will place the resulting layer in the correct spot in the layer hierarchy.
  5. Create a union layer that contains the resulting layer from the previous step, and a clone of that same layer. This is because running the built-in flatten on a union with just one layer won't simplify the paths. If there is an exact replica inside the union, then the resulting layer will have simplified paths.
  6. Run the built-in flatten against the union.


Plugin Details

Version1
CreatedApril 23, 2022
Last UpdatedApril 24, 2022
Categoryediting & effects plugins
Creatorsteven la
Stats2792 installs, 181 likes
PricingFree

Technical Details

  • API:1.0.0
  • main:code.js
  • Editor Types:
    figma