ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

source text return 3 values and include a + for positive values via a rotation slider

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Burgess
source text return 3 values and include a + for positive values via a rotation slider
on Aug 2, 2020 at 11:24:50 am

Hello, I have source text tied to 3 slider controls that are controlling rotation across 3 axis. What I am trying to do is force 3 values including + and - so there are always 4 characters and avoids jumping around when changing.

what I currently have looks like this...

-50X
3Y
360Z

and I want to achieve this...

X-050
Y+003
Z+360

I got a far as using using Math.round and +value but can't figure out how to add the extra numbers in and include a + for positive values. I was also struggling to get +value to work at the start as opposed to the end. Thanks for any help.

Math.round(effect("Y rotation")("Slider"))+value


Return to posts index

Filip Vandueren
Re: source text return 3 values and include a + for positive values via a rotation slider
on Aug 2, 2020 at 1:48:45 pm

Something like this:

y = Math.round(effect("Y rotation")("Slider").value);

"Y" + (y < 0 ? "-" : "+") + ("00"+Math.abs(y)).slice(-3);




Return to posts index

John Burgess
Re: source text return 3 values and include a + for positive values via a rotation slider
on Aug 2, 2020 at 1:57:55 pm

Thanks so much Filip, that worked perfectly


Return to posts index

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