Flex is an After Effects tool from Zack Lovatt for creating dynamically realigning layouts for your layers. It's listed in the aescripts library and supports a wide range of After Effects versions.
It includes a Grid Mode for arranging layers into grid rigs and a Line Mode with Row and Column options for laying layers out in lines. Gutter controls set the spacing between layers, measured in pixels.
Flex is at version 1.1.3, last updated in June 2022, and it's compatible with After Effects releases from CC 2015.3 through 2026. Recent fixes addressed an expression error on layers without sources and Grid Mode expression errors with the legacy engine. In the current build, Matte Mode and the Stroke Options for inner and outer shape layer strokes are disabled. A demo video is available.