I have layers of varying dimensions (160x600 1080x1080 320x250 480x320 728x90) roughly between 80 to 100 layers.
Is there a way to have these layers populate into a grid with even padding around each layer, attached is an example.
I'd rather not use expressions as I'm sure it will bog AE down; it it doesn’t have to be created in After Effects. It could be done in InDesign, Illustrator, or Photoshop and once in AE replace these placeholder layers with my comped layers.
I've had a Google, but the only real solution appear for CSS and website design. I'm here to ask if someone has seen or used such a grid layout before.
Copy link to clipboard
Thank you - I have grabbed that in the past but now on the latest version of AE it comes up with numerous errors and doesn't execute the script.
But yes, that would be perfect.
I've just checked and it works fine with the latest AE - V22.5
And if this doesn't help, what exactly are the error messages you receive when applying Collage?
Even when I'm set to the Legacy/Extendscript Expression Engine, Collage works fine.
So - what error messages are you receiving?
Thank you Roland - first thing I did was to check both engines just in case.
If I run it via file > scripts I get "Unable to execute scipt at line 2835. Object of type Function found where a Number, Array, or Property is needed"
If I install and run through KBAR, I skip that first error and get "ReferenceError: Function numeric.svd is undefined" and "no solution found!"
I run it through the Windows Menu and just tried it via File>RunScript and no issues.
Is your AE Prefs under scripting set up to allow Network access - see image below
And which version of AE and OS are you on?
Thank you Roland, I appreciate you're help.
Yes, that's ticked and I'm on macOS 12.4 and AE 22.5.0
It's most likely a kBar thing or MacOS or both. I would try disabling Kbar since it's the easiest to disable/uninstall. Sorry, I can't assist you more but do report back and maybe something does pop up in my head, I'll share it here. Good Luck.
I got it working by closing all scripts and then it could run. Unfortunatly, it's not quite what I'm after as it resizes each layer to fit. Thank you though.
Don't discount using expressions. You can get any layer size using sourceRectAtTime() or thisLayer.size.
By default, the Anchor Point is always at the layer's center. To distribute layers in a grid, you must know how wide the biggest layer is and then set up a multiplier based on the layer's index.
I don't have time to fiddle with a grid, but here's an expression that offsets layers in Y every 800 pixels starting with the position of a null layer on top of the stack.
ref = thisComp.layer("Null 1"); ofstNo = ref.index + 1 - index; grid = [800, 800] / 2; // pad + 1/2 the size of largest layer ref.position + [0, - ofstNo * grid]
It won't take much to take this starting point and set up a grid that is 10 X 15 and has all layers below lined up without doing anything else. You can then animate the position of the Null to move the entire grid around.
This stacks different-sized layers up in Y with 20 pixels between them;
ref = thisComp.layer(index - 1); lyrHeight = height/2 + 20; // 20 pixel padding newY = ref.position + ref.height/2 + lyrHeight; [ref.position, newY]
Thank you - I'm going to have a play with this and I'm sure I'll find some new uses out of it.
In your example, there are four layer sizes and the sizes have a very specific relationship to each other. For example, if the small squares are 100x100 and the gap between is 15, the rectangles have to be 100x215 (or 215x100) and the large squares would have to be 215x215. Unless your layer sizes are related like that (and it doesn't appear that they are), there's no algortihm that can assemble such a grid without scaling (and probably non-uniform scaling) the layers.
Thank you - I just found with no finate control over the scaling, layers became 3% of their original size to fit. I'll have to create one manually in illustrator and import and swap out.