ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Creating an expression for set position of lower third.

FAQ   •   VIEW ALL
 Creating an expression for set position of lower third. on Jun 6, 2019 at 7:17:07 pm

Hello,

I have been working on a few tutorials to get this to work but I'm completely lost and I need some help.

What I'm look at doing is creating a slider or some kind of controller that can be used with essential graphics (.mogrt) so an editor can place a lower third on the right, left or have it centered with set "X" values.

From what I have been researching it looks like a slider controller with .... Math.floor(clamp(value, min=1, max=3));' ...

1 = Left / 2 = Center / 3 = Right

If anyone could help me create this I would be forever thankful!

Thank you!

Bret

 Re: Creating an expression for set position of lower third.on Jun 7, 2019 at 6:56:17 am

Hey Bret, whats essential here, is how your lower third looks like. Please showcase an example to get a sense of it.

The reason why it is important - if you have a need to align text based on the direction and if there are more elements in common, then this will be a different story. Alternatively, if it's a single line, it will be easier approach to handle.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview

 Re: Creating an expression for set position of lower third.on Jun 7, 2019 at 5:44:27 pm

Hello Tomas,

Here is a Dropbox link to an example of the lower third.

https://www.dropbox.com/s/tlzasjzs1akkxzw/Stamps%20TV%20-%20Lower3rd%20Font...

Thanks,

BK

 Re: Creating an expression for set position of lower third.on Jun 7, 2019 at 5:53:18 pm

Bret,

thanks for sharing this, clarifies the point. Few more questions:
1. Is the lower third elements are structured in the pre-comp, or all layers exist in a single composition?
2. is the width of lower 3rd box can vary or will remain constant?
3. By left/right aligning, design will remain the same? Meaning, horse won't be moved in a different corner, etc?

Cheers!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview

 Re: Creating an expression for set position of lower third.on Jun 7, 2019 at 6:33:29 pm

Tomas,

1 - All layers are in a single comp. No pre-comps
2 - It should remain constant.
3 - The Design will remain the same with each alignment.

Bret

 Re: Creating an expression for set position of lower third.on Jun 10, 2019 at 1:05:07 pm

Hey Bret,

here is the easiest approach I can think of.

2. Add null layer which will control xPosition.
3. Set anchor point of null to be in the center of it.
4. Add slider control where you see it applicable based on your design.
5. Apply expression to the slider:
`Math.floor(clamp(value, min=1, max=3))`
6. Link all layers in the comp, which are not parented by now, to the null.
7. Apply expression below to null's position:
```xPosValue = Math.round(effect("xPos-direction")(1)); switch(xPosValue) { case 1: xPos = thisComp.width/3; //Adapt this based on your design break; case 2: xPos = thisComp.width/2; break; case 3: xPos = thisComp.width/1.5 //Adapt this based on your design break; default: xPos = thisComp.width/2; //Adapt this based on your design } [xPos, transform.position[1]] ```

This seems to do the trick - let us know whether it worked out. Cheers!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview

 Re: Creating an expression for set position of lower third.on Jun 11, 2019 at 4:37:39 pm

This is amazing, thank you so much! I will give it a try today and get back to you.

 Re: Creating an expression for set position of lower third.on Jun 11, 2019 at 5:00:40 pm

Hi Tomas,

I'm getting an error;

effect named 'xPos-direction' is missing or does not exist. It may have been renamed, moved, deleted or the name may have been mistypeed.

Thanks for the help,

Bret

 Re: Creating an expression for set position of lower third.on Jun 11, 2019 at 5:45:48 pm

Hey Bret,

its just the name of the slider controller, which will have 1-2-3 values. Replace this with your controller name.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview

 Re: Creating an expression for set position of lower third.on Jun 11, 2019 at 10:27:13 pm

Hi Tomas,

I tired getting this to work but I'm still having some trouble. When you say the name of the slider do you mean as a variable?

I tired adding " var xPos-direction = thisComp.layer("Justification Controler"); " but it is still not working. I'm getting an error that says "Expected: ;"

Once again, thanks for the help... expressions are not my forte!

Thanks,

BK

 Re: Creating an expression for set position of lower third.on Jun 12, 2019 at 2:53:31 am

Bret,

where you are going to apply this expression?
`Math.floor(clamp(value, min=1, max=3))`

Ideally it should be a slider on some of your control layers, and you need to take that slider's name, and use instead of xPosValue = Math.round(A LINK TO YOUR SLIDER);

In my example, 'xPos-direction' title is the name of the slider on Null's layer.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview

 Re: Creating an expression for set position of lower third.on Jun 13, 2019 at 4:42:12 pm

Hi Tomas,

I have linked to an image below showing you where I have placed each expression.

https://www.dropbox.com/s/aftfa5xkcx2be7x/Lower3rdPeoblem.JPG?dl=0

Thanks,

BK