Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all articles
Browse latest Browse all 47983

Appending a "%" to numbers from a string

$
0
0

I have an expression that is working in animating a percentage based on a slider control.

 

n=thisComp.layer("Null 1").effect("Pie Slice 2")("Slider")

 

nRound=Math.round(n*10)/10;

 

check = nRound % 1

 

if (check == 0){

""  + nRound  + ".0" + "%"

}else{

nRound

}

 

What I can't figure out is why the "%" only appears when the number is whole and not there constantly? After reading through Dan Ebbert page, he indicates that you can in fact add it (which I thought I did correctly) but only on the whole numbers. When it's animating through the "tenths" the % does not appear.

 

I'm sure it's something simple, but I can't figure it out.

 

Thanks for your help.


Viewing all articles
Browse latest Browse all 47983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>