-
[Help] automatically add "+" if value is positive
Hi Guys,
I wonder if anyone can point me in the right direction with this simple expression.
I want to show the percentage change of a political party. If the value is negative, After Effects will show me a minus accordingly, but I want to automatically add a plus symbol, if the value is positive.
I have a slider control (s) where I will input the current data. 10 is the historical value which the value form the slider will be compared to.
So far this is my expression (1 demical after the comma)s = thisComp.layer(“CTRL”).effect(“party_1”)(“Slider”)-10
d = 10;
x = Math.round(s*d)/d
x.toString().replace(“.”, “,”)+ “%”I tried a simple if-expression, but it would give me an error. Guess the expression can’t return a string?
s = thisComp.layer(“CTRL”).effect(“party_1”)(“Slider”)-10
d = 10;
u = if(s>0) {“+”};
x = Math.round(s*d)/d
u + x.toString().replace(“.”, “,”)+ “%”I’m thankful for any kind of help 🙂