Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Can you make an object follow a text length?

Community Beginner ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

Can you make an object follow the end of a text? I need to make the green dot (look at picture) follow the end of the text. I want it to work, so no matter how long or short the text is, the green dot will continue to be the same distance from the text.

It sounds a lot like some kind of expression. But is it possible?

I use this template daily at work and would love to make an essential graphic. But right now I have to move the dot manually every time i write a new text or change the text.

The reason why it's not just a normal dot, is because the dot is animating.

Hope someone can help.
Thanks in advance!

PICTURE:

punktum.PNG

TOPICS
Expressions

Views

4.3K

Likes

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

Mentor , Sep 27, 2018 Sep 27, 2018
I can confirm, that it works the way I said - just tried it. I used this expression on the position of the dot:x=thisComp.layer("SText").sourceRectAtTime(time,true).width + thisComp.layer("SText").transform.position[0] + effect("x Offset")("Schieberegler");y=thisComp.layer("SText").sourceRectAtTime(time,true).height + thisComp.layer("SText").transform.position[1] + effect("y Offset")("Schieberegler");[x,y];I added two slides on the dot for x- and y-Offset and I added the position data of my text...

Likes

Translate

Translate
LEGEND ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

See this thread for a similar question and the expressions to use:  https://forums.adobe.com/thread/2255778

Likes

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
Mentor ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

Yes, you can and it's quiet easy!

As you pointed out, it's a matter of an expression:

thisComp.layer("YOUR TEXT").sourceRectAtTime(time,true).width + OFFSET;

This snippet gives you the width of your textbox. With the OFFSET, you can fine tune the position.

A complete control over x and y values would look like this:

x=thisComp.layer("YOUR TEXT").sourceRectAtTime(time,true).width + xOFFSET;

y=thisComp.layer(("YOUR TEXT").sourceRectAtTime(time,true).height+ yOFFSET;

[x,y];

Cheers,

Martin

Likes

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 27, 2018 Sep 27, 2018

Copy link to clipboard

Copied

Okay, so this works like the way i want to... BUT. The dot is moving slower than the text. So when i write a longer text, the dot automatically moves into the text. Watch picture:

punktum2.png

Likes

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
Adobe Community Professional ,
Sep 26, 2018 Sep 26, 2018

Copy link to clipboard

Copied

What do you mean when you say the dot is animating? If the dot is stationary or you want the dot to move as the text animates on you can fix the position using this an expression. The method  can be found in about 10 seconds by typing "text size expression" or something similar in the Search Help field at the top right corner of After Effects and then searching the Expression Language page for "text":

sourceRectAtTime(t = time, includeExtents = false)

Return type: JavaScript object with four attributes: [top, left, width, height]. Extents apply only to shape layers, increasing the size of the layer bounds as necessary, and paragraph text layers (After Effects 15.1 and later), where it returns the bounds of the paragraph box. Example: myTextLayer.sourceRectAtTime().width.

You will have to take into account the anchor point and position of the text layer. For example, if the text layer was one layer below the dot layer this:

w = thisComp.layer(index + 1).sourceRectAtTime().width;

would return the width of the text layer at the current time. All you then have to do take into account the text layer's position, anchor point, paragraph style, and baseline shift. The easiest way to do that would be to make sure the anchor point of the dot layer is centered on the dot and use a value + statement for both X and Y like this:

w = thisComp.layer(index + 1).sourceRectAtTime().width;
[value[0] + w, value[1]]

If the paragraph style is centered then you would have to divide w by 2.

If you want the position to be automatic then you'll have to add in calculations and links to the text layer's position, anchor point (if changed) and you'll have to consider or add in a text animator for baseline shift.

That should get you started anyway.

Likes

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 27, 2018 Sep 27, 2018

Copy link to clipboard

Copied

This works the same way as martinr's suggestion. Read my answer above... But the same is happening with your suggestion. I dont comepletely understand how to fix this, even though i can see you triede to explain that to me

punktum2.png

Likes

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
Mentor ,
Sep 27, 2018 Sep 27, 2018

Copy link to clipboard

Copied

I can confirm, that it works the way I said - just tried it.

I used this expression on the position of the dot:

x=thisComp.layer("SText").sourceRectAtTime(time,true).width + thisComp.layer("SText").transform.position[0] + effect("x Offset")("Schieberegler");

y=thisComp.layer("SText").sourceRectAtTime(time,true).height + thisComp.layer("SText").transform.position[1] + effect("y Offset")("Schieberegler");

[x,y];

I added two slides on the dot for x- and y-Offset and I added the position data of my text. Somehow (depending on anchorpoint and individual positions), the dot was displaced in y-axes, but that's what are the offset-sliders are for.

I've created a new textfield with more content, duplicated my dot and edited the names of the layers, so the new dot gets connected to the new, longer text. Once everything is aligned properly, it works for every text length.

You can download the project file here:

Dropbox - DottyDot.aep

Notice that you have to change "Schieberegler" in the expressions to "slider", when you are have installed an english version of AE.

Cheers,
Martin

Likes

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 ,
Oct 15, 2018 Oct 15, 2018

Copy link to clipboard

Copied

THANK YOU SO MUCH, Martin!

This works now.. Amazing!


Only one more question.. When I make a "g" or a "Q" the dot jumps down. Can you fix this somehow?


Have a great day 🙂

Cheers

Likes

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 ,
Apr 11, 2021 Apr 11, 2021

Copy link to clipboard

Copied

LATEST

Hello! I am trying your expresion but it says that theres no such effect as offset (i have a bumblebee that Im trying to follow the last letter with!)

Is this right?

(My text olayer is called "Name Text")

 

x=thisComp.layer("Name Text").sourceRectAtTime(time,true).width + thisComp.layer("Name Text").transform.position[0] + effect("x Offset")("Slider");

 

y=thisComp.layer("Name Text").sourceRectAtTime(time,true).height + thisComp.layer("Name Text").transform.position[1] + effect("y Offset")("Slider");

 

[x,y];

 

am i missing something?

 

 

Flame2bits_1-1618143348516.png

after removing that effect:

Flame2bits_2-1618143401610.png

 

After removing slider (and +effects) and offset it worked and i used anchor point to locate it to the rihght starting point.

 

 

 

Likes

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
Adobe Community Professional ,
Sep 27, 2018 Sep 27, 2018

Copy link to clipboard

Copied

NiklasKLarsen  wrote

This works the same way as martinr's suggestion. Read my answer above... But the same is happening with your suggestion. I dont comepletely understand how to fix this, even though i can see you triede to explain that to me

punktum2.png

If you used my expression, divided m by 2 and had the paragraph centered it will should work just fine.

w = thisComp.layer(index + 1).sourceRectAtTime().width;
[value[0] + w/2, value[1]]

All you have to do is move the dot layer to the end of the text after the last keyframe for text and you should be done.

Another thing that could be causing problems is the way you are animating the text. Without seeing your timeline with the modified properties of all layers it's impossible to tell what the problem is. If you are just using something like the typewriter preset you'll have to complicate things a lot more because the opacity is being animated for each letter instead of the actual characters. The size of the paragraph (length of the line) is constant.

If you can't figure it out just select the text layer and the dot layer, press the U key twice and then PrintScreen and paste to the forum so we can see what you are doing in the comp.

Likes

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