Copy link to clipboard
Copied
Hello, I was wondering how do you make an expression that each layer will automatically adjust its transform or spacing between the other layers. Also I keyframed the position of each layer because I want to fade in and moves up when called.
I'll have to convert them to MOGRT so it'll save me some time when I use it again.
Could be infinitely complicated, to be honest. Grabbing the bounding box using sourceRectAtTime() is easy as is adding trhe necessary padding, but things can quickly go crazy if you have multiple layers set up this way and interacting, especially when they are already animated. A lot of valueAtTime() stuff to adjust the keyframed positions. And whether all of this actually works correctly inside a MOGRT is another question. Not saying it's impossible, but it's not going to be trivial, either. An
...Copy link to clipboard
Copied
Could be infinitely complicated, to be honest. Grabbing the bounding box using sourceRectAtTime() is easy as is adding trhe necessary padding, but things can quickly go crazy if you have multiple layers set up this way and interacting, especially when they are already animated. A lot of valueAtTime() stuff to adjust the keyframed positions. And whether all of this actually works correctly inside a MOGRT is another question. Not saying it's impossible, but it's not going to be trivial, either. Anyway, start by researching the usual "text box adapting to text length" tutorials and similar stuff to get an idea what challenges you are potentially facing.
Mylenium
Copy link to clipboard
Copied
Hey Mylenium! sourceRectAtTime() works 🙂 sorry for not updating that I found the answer to it.
(sorry in advance if my grammar is a bit confusing to read especially mixing it with coding language)
What I did was adding an animator position to the text (didn't use transform position because I already had keyframed to move in) , so everytime I duplicate the layer, it would automatically go down and also move itself depending on the previous text.
var a = thisComp.layer(index-1);
var b = a.sourceRectAtTime().height;
var c = thisComp.layer(index-1).text.animator("Animator 1").property.position[1];
[0,b+(c+thisComp.layer("Texts Spacing Controller").effect("Slider Control")("Slider"))]; // Added a slider to set values if how much spacing do I need between each text layers.
(Hope it made sense to think about it, cuz i dont know how to explain it)