FORUMS: list search recent posts

Position Change Script

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ricky London
Position Change Script
on Aug 29, 2018 at 4:12:23 pm
Last Edited By Ricky London on Aug 29, 2018 at 4:27:29 pm

Hi Guys,

Sorry if this has been asked before but I couldn't find it.

I am trying to write an if else statement for a 3 liner text box.

I want the position of the text to change depending on how many lines of text e.g.

if there is only 1 line of text it will drop down.
if there is 2 lines it will drop down less.

( I was thinking maybe targeting the Character count (accounting for spaces) of each line of text and then when it reaches max position will change, but not sure how to write this with correct syntax. )

max char line 1 = 10
max char line 2 = 20
if charcount(trim) = 10? , horizontal position - 10
else if charcount = 20 , horizontal position - 5
?


This is for a MOGRT if anyone is wondering why you would do this.

Thanks,


Return to posts index

Cassius Marques
Re: Position Change Script
on Aug 29, 2018 at 5:52:26 pm

count = 0;
for (i=0; i < text.sourceText.length; i++)
{
if (text.sourceText[i] == '\r')
{
count++;
}
}
value-[0,10*count]


I'm Changing vertical position based on how many Enter keys you've got.

Cassius Marques
http://www.zapfilmes.com


Return to posts index

Cassius Marques
Re: Position Change Script
on Aug 29, 2018 at 5:57:01 pm

If you need it in an If/else format you can go like

count = 0;
for (i=0; i < text.sourceText.length; i++)
{
if (text.sourceText[i] == '\r')
{
count++;
}
}
count == 2? value-[0,10] : (count == 1? value-[0,5]: value)


You can then just type in the values for the position or do some math. (I'm supposing a 1-3 line text case)

Cassius Marques
http://www.zapfilmes.com


Return to posts index


Ricky London
Re: Position Change Script
on Aug 30, 2018 at 10:18:39 am

Hey Cassius,

Thanks for this it's great!

just one small problem, as it's for a mogrt there wont be any enter key presses allowed just the text bounding box will push the text to the next line, so would something like this work?

if (text.sourceText[i] => 10(characters) )]

Thanks,
Ricky.


Return to posts index

Ricky London
Re: Position Change Script
on Aug 30, 2018 at 11:00:10 am

Actually after adding a line break in ae essentials source text it shows up in premeire as seperate lines the only problem is that the script does not translate to the premiere mogrt and lines do not move when deleted.. ( i don't believe that it is reading the seperate lines as an enter keypress)

can someone test this in premiere :


add this to text position:

count = 0;
for (i=0; i < text.sourceText.length; i++)
{
if (text.sourceText[i] == '\r')
{
count++;
}
}
value-[0,90*count]

then add 3 line breaks in the mogrt template and import it into premiere?


Return to posts index

Cassius Marques
Re: Position Change Script
on Aug 30, 2018 at 7:04:49 pm

yeah sorry, I've never used templates in Premiere, I never thought how would the interaction work nor how any changes would be evaluated. I'm an AE guy.

Its up to you guys to build any remaining bridges.

Cassius Marques
http://www.zapfilmes.com


Return to posts index

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