• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Problems with animated text using sourceRectAtTime

Community Beginner ,
Jun 27, 2024 Jun 27, 2024

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]

TOPICS
Error or problem , Expressions , Scripting

Views

135

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 27, 2024 Jun 27, 2024

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]

Votes

Translate

Translate
Community Expert ,
Jun 27, 2024 Jun 27, 2024

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]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2024 Jun 28, 2024

Copy link to clipboard

Copied

*chef kiss* works perfectly thanks 😄

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2024 Jun 27, 2024

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. 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2024 Jun 28, 2024

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines