ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Position text only inside area

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Niclas Hallgren
Position text only inside area
on Mar 20, 2020 at 9:43:44 am

Hi!

I've to generate a comp that will show 160+ names (four names at a time) at random positions. The output will be a 3840x2160 file but as it a video wall (4 screens) there are areas that will not be visible. I'm generating a comp from scratch (run script file) and everything is working perfectly but as it is now I must manually move the layers to fit inside the visible area.

Have someone done this and can give me some advice before I'll try to re-invent the wheel 😉



Return to posts index

Andrei Popa
Re: Position text only inside area
on Mar 22, 2020 at 9:04:09 am

Har way, but looks better:
You can save data for the layer(width, top, bot, left, right). First, check if the layer has one of the 4 corners out. Then check if its smaller than a screen(as width). If it is, move it horizontally to fit inside the screen. If it's larger, move it vertically until it reaches the point where it can be displayed on 2 screens.

Easy way:
Put the text only in the space with all the screens(red area).


Andrei
My Envato portfolio.


Return to posts index

Niclas Hallgren
Re: Position text only inside area
on Mar 22, 2020 at 10:01:02 am

Thanks for the input Andrei. I had the same thought but the client wants more spread to the names so I can't limit it to a box in the middle. I remade my shape layer so it is now one instead to four and I found Dan Ebberts collision guide that might be the solution to the problem.



Return to posts index


Andrei Popa
Re: Position text only inside area
on Mar 26, 2020 at 8:40:51 am

Here is how i would do this. Draw the rectangles from the first picture again. Then also draw the red one I made. After placing the text, add a function that does this:

(is the layer inside red square?)
yes =>DONE
no=> (is the layer's width smaller than one rectangle?)
yes => check which rectangle is closer and place it entirely there by changing x position
no=> reposition layer and rerun this function.


To check which rectangle is closer, first check y position and see if its bottom or top. Then I think you can easily check which one is by considering the position and the justification of the text.

Also, the project will run much faster if you do this with script at the creation point and not with a lot of expressions.

Andrei
My Envato portfolio.


Return to posts index

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