Skip to main content
love_felis
Inspiring
August 22, 2017
Answered

Change Position of Text Depending on Value of Slider

  • August 22, 2017
  • 2 replies
  • 2368 views

I have a text that outputs the value of a slider I have set up. I would like the text to change position when it goes from 1 digit to 2 digits so that it will stay centered.

I was trying to create an If/then statement to do so. Here is how far I've come, I may be way off:

if (thisComp.layer("Control").effect("Slider Control")("Slider")>18) 956, 532;

So If the slider value is greater than 18 then the text position will be 956, 532.

Cheers,

Evan

This topic has been closed for replies.
Correct answer Mike_Abbott

evanc1244373  wrote

I have a text that outputs the value of a slider I have set up. I would like the text to change position when it goes from 1 digit to 2 digits so that it will stay centered.

I guess I must be missing something... but couldn't you just use centred paragraph alignment?

2 replies

Mike_Abbott
Mike_AbbottCorrect answer
Legend
August 23, 2017

evanc1244373  wrote

I have a text that outputs the value of a slider I have set up. I would like the text to change position when it goes from 1 digit to 2 digits so that it will stay centered.

I guess I must be missing something... but couldn't you just use centred paragraph alignment?

love_felis
Inspiring
August 24, 2017

Indeed you are correct. I got so caught up in my expressions that I over complicated the issue. Cheers!

Inspiring
August 23, 2017

Something like this should work:

pos1 = [946, 532];

pos2 = [956, 532];

if (thisComp.layer("Control").effect("Slider Control")("Slider") > 18) {

finalpos = pos2}

else {

finalpos = pos1};

finalpos

Just edit the two positions pos1 and pos2.

The if else expression works this way: http://www.motionscript.com/mastering-expressions/language-beginning-4.html

The Language - Part I

love_felis
Inspiring
August 24, 2017

Thanks Davide this is what I was looking for. Cheers!