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

Expression to align text to shape

Community Beginner ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

I have an answer box to produce into a template. I'd like the user to type the answers into the boxes but the answers may vary from one line or two. I'm using paragraph text not point text so it doesn't type outside the box.

 

Problem: So if space for two lines but an answer only reaches one line the text is then aligned to the top not the centre, it looks silly but makes sense since the paragraph text allows for two lines. Obviously if I allow for one line I won't be able to include full answers.

 

I'm looking for an expression and because I'm not THAT advanced, the expression method. I assume I'll need to pick whip to the shape layer in the expression? but I don't want the shape layer/text box to auto-scale! just auto-align. I also don't want the font size to autoscale either. Not entirley sure what to put where - where to type the expression on what layer. I assumed it would be in the anchor point or position of the text then pickwhip but the text box won't be moving so I'm really unsure. I found some websites and forums that almost answers me but still lost.

https://creativecow.net/forums/thread/center-anchorpoint-no-matter-the-content-of-text-f/
https://www.reddit.com/r/AfterEffects/comments/54bhsh/scale_text_to_fit_inside_box_expression/

Last one almost worked but it didn't quite consider the shape layer even when I changed thiscomp to this layer and used pickwhip.
// calcuate the center of thisComp.layer("A");

[thisLayer.width/3.5, thisLayer.height/2]

Never done expressions before so that was the best I could attempt to work out

TOPICS
How to

Views

170

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 ,
Oct 20, 2020 Oct 20, 2020

Copy link to clipboard

Copied

LATEST

Shape layers use the generic "content" syntax and addressing as specific item within a shape layer group would therefore have to look something like thisLayer.content("group").content("sub-group").content("item") in pseudo-code. You have to traverse the hierarchy. Either way, start by looking this stuff up in the online help. It's really not that complicated and while possibly not the besst resource, there's enough links to tutorials and explanations there. No point blindly fishing for code snippets on the Internet when you don't even know what to look for or where to apply them.

 

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