FORUMS: list search recent posts

Expression or technique to space text from line above

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matt James
Expression or technique to space text from line above
on Mar 16, 2019 at 7:28:49 pm

Hi all

I have a comp with 3 text layers, spaced nicely vertically.

I am trying to figure out a way that if line 1 was to increase in size, it would push down line 2, maintaining the space (or padding) between the layers.

I am thinking pickwhip the position of line 2 to line 1 if I could then add the height of line 1 to the position of line 2?

Image below shows what I want to achieve.



Thanks in advance.


Return to posts index

Dave LaRonde
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 12:53:53 am

I do not ever worry about such things. I simply adjust vertical position. I eyeball it.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Matt James
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 1:06:05 am

Cheers Dave, but it's for a client who doesn't want to risk breaking anything.

Can you suggest a way to achieve this automatically?


Return to posts index


Dave LaRonde
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 1:11:48 am

My client happens to be the biggest owner of TV stations on Planet Earth.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Matt James
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 1:25:21 am

I'm not sure what do with that information, but thanks?!

I'm handing the project over and they don't want to have to do anything apart from edit text (not moving)


Return to posts index

Dave LaRonde
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 4:13:27 am

Okay. They want to change the text. How do you now what they are going to DO with the text? I'm sorry, but you've set yourself up for failure.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index


Matt James
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 11:52:57 am

Thank you Dave. But, my life choices aside, is this technically possible? (Irrelevant of real world usage)


Thanks


Return to posts index

Kalleheikki Kannisto
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 4:28:44 pm

The short adnswer is "yes". Similar situations have come up numerous times. Check the expressions forum for cases where someone wants to push other layers down when scaling one layer.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Tomas Bumbulevičius
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 5:06:15 pm

Hey Matt,

it's not that hard, and definitely - a lot more reasonable than doing it manually EVERY TIME. Manual work always leaves an area for error, and who are the ones to blame - designers, who developed solution not thoughtful enough (:

There are few things for you to consider:
1.Text will always remain 3 in lines as in example?
2. How size will be changed - by scale or by font size in characters panel?
3. What else is done with these text layers apart from the change of their text values? Are there any other transformations applied, position/anchor point/rotation?
4. Once new values are added - is it possible that it might require to change texts positions?

If answered, I could help you out. Cheers.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.


Return to posts index


Matt James
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 5:10:43 pm

Thank you Tomas.

To answer your questions:

1) In this instance, yes all three lines will be centred and remain as shown
2) I have a max-width expression on the scale property of each line. If the text exceeds 80% of the comp width, it auto scales down. Character/font size is fixed, the scale property is what will push the other lines down
3) No other transformations etc
4) No, further repositioning won't be required.

Thanks again

M


Return to posts index

Tomas Bumbulevičius
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 5:33:46 pm

Alright Matt, here is how I envision this. Assuming that scale is applied, based on the image sample, I guess anchor point is set to the top of the layer. Anyways, if not, here is the whole idea breakdown:

1. In the comp, create null layer, name it 'control' .
2. Apply Slider effect and name it 'y-offset'. This will control the gap distance.
3. Assuming all text layers in the project panel are placed on after another:
ONE
TWO
THREE

Apply this expression to the anchor point for all layers:

sourceSize = thisLayer.sourceRectAtTime(time, false);
T = sourceSize.top;
L = sourceSize.left;
W = sourceSize.width;
H = sourceSize.height;
([L+ W/2,T+0])


That way, we will get full layer height value in position expressions.

4. For second and third layer's positions, apply this expression:

yDiff = thisComp.layer("control").effect("y-offset")(1); //Gap distance between the lines
y = thisComp.layer(index-1).transform.position[1]; //Previous layer Y position
s = thisComp.layer(index-1).transform.scale[0] / 100; //Scale ratio
h = thisComp.layer(index-1).sourceRectAtTime(time, false).height; //Previous layer height

[value[0], y + s*h + yDiff]


First layer's Y position will stay constant, others will accommodate. Change control layer's 'y-offset' to set desired gap.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.


Return to posts index

Matt James
Re: Expression or technique to space text from line above
on Mar 17, 2019 at 6:01:35 pm

This is excellent and does exactly what I needed Tomas, thank you!!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]