The goal is to automatically stack multiple instances of the same "Template Comp" based on layer order, in a situation where the 'Element' it represents has a dynamic size. In my quest to make my ideal "end-game" social media templates, this "auto-stacking" would be particularly useful for creating animated graphics of Posts, Comments, and other "feed-based" interfaces you commonly see.
00:16 - Pinning Elements, Exposing Height
00:58 - sourceRect() of a Comp Layer
01:40 - Trying to use a "Computed Property"
02:18 - AE KNOWS what to do, just falling short ˘•́︵•̀˘
02:57 - See? It knows!!
The work I've put in so far has led to tons of amazing stuff to walk through — at length — in future videos regarding some cool features within the Post Templates I've made; but outside of that, being able to stack multiple templates automatically would just be the perfect icing on the cake to tie it all together. 🤌 #FreeComputedPropertiesAdobe
It's first worth mentioning that After Effects does not have any inherent mechanic for a "variable" Comp size — each Comp you see in the Project panel has it's own assigned Size, and every instance of it used inherits that size – You can change it after it's been created, but the new size will apply to every instance of that Comp. Workarounds can be messy if not super-intentional.
Essential Properties in Modern Templating
In After Effects, "Template Comps" have been a valuable tool for many. Using Essential Properties*, which can be applied to most properties/effects in a comp (and even props inside *nested comps as of AE 2024-Aug ! ), you can have multiple instances of the same Template Comp in your Project, with Essential Properties now exposed for each instance that can change the look of them/chosen properties individually.
This has been such a great addition to After Effects, and even gives Premiere Pro users some extra power. Stuff like Color Variations, Source Text "Slots", Sliders, and other Custom Controls for the size/position of elements, are just some of the very powerful abilities gained by letting Comps have special instance-specific Essential Properties.
Essential Props Can Change Stuff in the Comp
Sometimes the size of things in our comp varies. Think of a lower-third graphic. If my template has a rectangle shape behind the Name text, I can use sourceRectAtTime() to automatically always have the size of the box fit the text with the padding I want, no matter what length of name I put into the Name Source Text Essential Property that ends up displaying.
In cases like these, all the calculation is happening *within the Comp that has the relevant Essential Properties* — We don't really have a way of "reading anything" from the Template Comp when it's placed *in another Comp as a Layer*, aside from the normal, "static" Comp properties it shares with all of it's instance-siblings that may be in the Project.
sourceRectAtTime() on a Comp Layer:
The 1st strategy I show off in this video is attempting is use sourceRectAtTime() similar to regular "anchoring" expressions, but on a Comp Layer — Spoiler: AE seems to "know" the expected "sourceRect" based on what that instance ends up displaying as, but doesn't quite calculate it correctly.
You can see this clearly by toggling Collapse Transformations/Continually Rasterize on a dynamic-size Template Comp, as you change it's height dynamically, you can see 01:10 the expected sourceRect updating, but never reflecting in the expression its referenced in.
Ok, well how about a "Computed" Property, that lets the Comp "tell us" it's height?
The 2nd strategy I show off is an attempt at exposing a "Computed Property" as an Essential Property. In other words, there is a property in my Template Comp that is calculated and determined soley by an Expression, usually dependent on other Essential Properties, properties, and expressions within the Template. When I make this "computed" property an Essential Property, because it's expression doesn't depend on `value`, I am unable to change it via the Essential Graphics panel, and the Essential Property in the Comp Layer has "This essential property is controlled by an expression in the Primary Comp. Click here to override." displayed it's expression area.
What happens when I try use a "Computed Property" of a Template Comp Layer inside of an expression? In my experience, sometimes it works, but things get especially broken when you're trying to affect multiple instances of the same Template Comp, like when automatically vertically-stacking based on a computed height.
Wow it !! — Works.....?
After Effects WANTS to do it right, and as you can see in the Wireframe view, it gets the math right! It just doesn't render properly... so Adobe please, I implore you to investigate this behavior and possibly open the door to using "Computed Properties" in our Templates, Comps, and Projects !! (Even IF Premiere users will miss out) !! #FreeComputedPropertiesAdobe