Adjusting line space based on the text layer height

Moderators: Disciple, zlovatt

Post Reply
Posts: 2
Joined: September 30th, 2019, 3:53 pm

Hey Guys! Feeling great to be here, I am currently working on a project, and trying to develop some expressions to help myself work smarter. And here are some details of what I am trying to achieve:

I have applied the following expression to the scale of a regular Point Text layer, then when the content you type in is wider then 500 pixels, it will scale down the layer so it won’t exceed 500 pixels

Code: Select all

if (x>scl)


It’s working pretty nice.

But when I input line return to the text: since the expression scales the whole layer, including the vertical scale, the result is not visually what I want:


I hope to keep the line spacing between lines visually the same even after the scale expression scales down the whole layer:


So I developed the following expression, and put on the line space

Code: Select all


This expression kind of works when I change the preview resolution to force the preview refresh, or use Edit>Purge>Image Cache Memory, but sometimes both ways won’t work


I assume the reason is because the line space expression makes it react to the layer height, but when the line spacing increases, the layer height will also increase, then the expression will make the line space to react to that again… which creates a “loop” and confuses the AE.

If that’s the case, I am wondering if that’s other way to achieve the line spacing purpose without creating that “loop”, or maybe a better/ easier way to force refresh the preview so it can work every time?

Any help will be greatly appreciated!

Attached with the AE file to better illustrate the situation: ... e.aep?dl=0
User avatar
Posts: 10
Joined: April 13th, 2019, 2:19 pm

Yeah, the Line Spacing property is behaving weird for me too. Maybe the type animators are buggy when it comes to Expressions, or there's some strange logic to the way they handle Expressions value assignments that I don't know about.

I set your LineSpace var to a number of different things to test. Simple static values (100) didn't really work: scrubbing the second Line Spacing prop value (value[1]) would override whatever I set the LineSpace var to, which it shouldn't have. The only way I could get your LineSpace var to override the native value[1] was to set LineSpace to something like:
LineSpace = time * 100;

Then it worked. But that's obviously not the calculation you want. I tried keeping time in there but mitigating it, and adding my own custom math, but the more I did, the more AE went back to ignoring the value of LineSpace altogether and replacing it w/ value[1].

So I dunno, sorry. You could file a bug report or post something on AE's UserVoice site.
Posts: 2
Joined: September 30th, 2019, 3:53 pm

Thanks so much for the help.
Yeah I believe its about some AE expression logic thing now.
I will file a report to Adobe and let's see what they say :D

Thank again for your help
Post Reply