Activity › Forums › Adobe After Effects › Define the Anchor point of a text layer
-
Define the Anchor point of a text layer
Posted by Inder Mand on May 24, 2005 at 12:44 pmHi,
I need to define the anchor point of my text layer to the center of the composition, so that whenever i type anything it should end up being centered in the composition.
I would be using java scripts to change text everytime for mass customizing purposes. Can anybody help me on this.
thank you
Inder Mand replied 20 years, 11 months ago 2 Members · 3 Replies -
3 Replies
-
Inder Mand
May 24, 2005 at 4:12 pmHey,
Thanks, i think i did not explain it in the right way.
I know about using the center tab on the paragraph pallette, but my real problem arises when, let me explain.
For eg: I start typing my text from the center of the composition and when i press the ENTER key it goes to the next line, but in that case if i typed 5 lines then it would be center aligned horizontally ,but Vertically aligned, i dont think so. So here i would have to manually move it to the center.
But as i mentioned earlier, that i would be using it for mass customizing, hence would not be able to position it manually.
Hope you understand what i am trying to prove here. Everytime text would be replaced via JAVA Scripts for that particular aep project and the replacable text would be added in the txt document of the java script.
I know it sounds complicated, do give a shot at it if you can.
Thanks again.
-
Filip Vandueren
May 24, 2005 at 10:37 pmHello Indy;
I’ve tried to come up with an expression, but I’m not sure it will help.
This expression assumes that all lines have the same leading, and that the anchorPoint is currently set to [0,0] (and text is centered of course).Apply this expression to the anchorPoint of the text-layer:
leading=50; // this value cannot be retrieved using expressions! Set it manually
linefeedch = "r" // if it doesn't work try changing this to "n", works on mac maybe not on wintheText=thisLayer.text.sourceText.value
numlines=theText.split(linefeedch).length -1;
anchorPoint + (leading * [0, (numlines/2) -0.2]) // the 0.2 value depends on your Font & typesize
[0,0] is actually the baseline, so the -0.2 is used to center the anchorPoint for a 1-line text,
but you may need to change it depending on the design of your font and the ratio between leading and fontsizehope that helps.
-
Inder Mand
May 26, 2005 at 2:53 amHey,
Thanks for the effort and time.
I ll try this out and let you know if it worked.
cheers
Reply to this Discussion! Login or Sign Up