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

Help with sourcerectatTime?

Community Beginner ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Hello, 

 

I am trying to create a message-like animation in After Effetcs. This is what the "message" looks like : 

 

Screen Shot 2022-09-18 at 2.35.56 AM.png

 

I have a s.sourceRectAtTime expression that changes the box width and height depending on how long the text is. However, the two other icons (the circle with an M inside of it and the text that reads "TEXT 1") do not move along with it, and end up looking something like this : 

 

Screen Shot 2022-09-18 at 2.43.36 AM.png

 

As you can see, the text gets longer, and the box gets longer with it. However, I want the circle with the letter in it and the text that reads "TEXT 1" to move accordingly with the box width, like this :

 

Screen Shot 2022-09-18 at 2.37.06 AM.png

 

The problem is, to get it to move like this I need to manually move the two icons, and it's a bit time consuming. I don't know too much about expressions, but if there was one to help with this, it would be greatly appreciated, thanks!

TOPICS
Expressions

Views

122

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
LEGEND ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

You simply move the icon by the amount of change plus padding. Could be as trivial as

 

mText=thisComp.layer("Text");
mRec=mText.sourceRectAtTime();
mPos=mText.transform.position;
mPad=20;

X=mPos[0]-mRec.width*0.5-mPad;
Y=value[1];

[X,Y]

 

Mylenium

 

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 ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Hello, thank you so much for your reply, the expression worked and the icons move with the width of the text. I can't believe it's that simple, but do you know how I could modify this expression so that the icons also move with the height of the text? 

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
LEGEND ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

LATEST

Change the line for Y position to something like that:

Y=mPos[1]+mRec.height*0.5+mPad;

Mylenium

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