Copy link to clipboard
Copied
Hello AE Community!
Is there a way to add a character - specifically "%" - to the text in a countdown expression?
Right now I have the expression:
Math.round(thisComp.layer("Values").effect("Value_1")("Slider"))
and it is working just fine for displaying the number related to the slider. I would like to add a "%" on the end, so that when it changes from 100 to 99, and then from 10 to 9, the tracking stays consistent between the numbers, so I don't end up with "9 %"
I have thought of some work-arounds, but I was hoping there was some simple language to put into the expression to add the "%" mark.
Thanks!
Copy link to clipboard
Copied
Let's start simple. Does this not work for you?
Math.round(thisComp.layer("Values").effect("Value_1")("Slider"))+"%"
Dan
Copy link to clipboard
Copied
Thanks for replying, Dan.
I tried that, and a few variations, but it kept turning my number into “NaN” whenever “%” was in my expression.
Copy link to clipboard
Copied
Did you apply the expression to a numeric property (like a slider control)? You would need to apply it to a text layer.
Dan
Copy link to clipboard
Copied
Yes, it is on a text layer.
if ‘+ “%”’ should work, then perhaps something else in my composition is causing the problem.
Copy link to clipboard
Copied
make sure the +"%" operation is applied after all mathematical operations (like rounding) you do with the number. Does the NaN only occur with the "+"%" or also if you remove this part from the expression?
Maybe you best post the entire expression you use.