Thursday, November 16, 2017

Limiting Decimal Places In Text Layers

Adding .toFixed(4) after the variable limits the decimal places to 4.  ie 26.7835
Adding .toFixed(2) would limit the decimal places to 2.  ie 26.78
.toFixed(3) would limit the decimal places to 3.  ie 26.784  (note it rounds value)


ex:  avgEQ = (thisComp.layer("1").transform.scale[1] + thisComp.layer("2").transform.scale[1])/2;
       avgEQ.toFixed(4)

No comments:

Post a Comment