Copy link to clipboard
Copied
Hello, Im doing an animated text inside a Rectangle.
The animation is like the "Typewriter" template, but instead of opacity I used scale 0%
The animation works great if i play it from frame 0, but if i grab the Text and Rectangle layer and move to the frame 100, the Rectangle is already in full size when my text is empty.
Is like the size of my text is being read from the layer timeline, instead of the composition timeline.
Expression im using in my Rectangle
x = thisComp.layer("text").sourceRectAtTime().width;
y = thisComp.layer("text").sourceRectAtTime().height;
[x,y]
sourceRectAtTime() has a built-in time parameter, so I think you just need to do something like this:
L = thisComp.layer("text");
x = L.sourceRectAtTime(time - L.inPoint).width;
y = L.sourceRectAtTime(time - L.inPoint).height;
[x,y]
Copy link to clipboard
Copied
sourceRectAtTime() has a built-in time parameter, so I think you just need to do something like this:
L = thisComp.layer("text");
x = L.sourceRectAtTime(time - L.inPoint).width;
y = L.sourceRectAtTime(time - L.inPoint).height;
[x,y]
Copy link to clipboard
Copied
*chef kiss* works perfectly thanks 😄
Copy link to clipboard
Copied
If you are using a text animator or scale, you will have to throw in a multiplier for Position to keep the rectangle lined up because the rectangle size will grow using Dan's expression, but it will not be offset. You will have to take sourceRectAtTime(when the text is fully revealed) and create a linear interpolation method that adjusts the Rectangle 1/Position so the box expands from the left side of the text instead of the middle. You still may have a problem with the rectangle jumping around because the text scales from the middle. I don't have time to fiddle with it right now, but I have created similar things in the past and ended up relying on a simple expression that uses the size of the text at the last keyframe and a simple linear interpolation between the first and last keyframes.
Copy link to clipboard
Copied
Luckily i have the text aligned to the side, and in the Rectangle i have the following Expression in position
content("BOX").content("Rectangle Path 1").size/2