Copy link to clipboard
Copied
Hi,
I'm trying to combine these two expressions, one cancels out the other...
can anybody please help me out?
// 1st expression for changing the font
var fontArray=[
"BerninaSansOffc-Regular",
"DTFlowTextV1.011-Regular"
]
v=Math.round(thisComp.layer("Null 19").effect("Font CTRL")("Slider"))
style.setFont(fontArray[v]);
// 2nd expression counter for numbers greater than 1 mil. with point control
num = (thisComp.layer("Null 19").effect(1)(1)[0]).toFixed(2);
function addCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");
}
addCommas(num)
Copy link to clipboard
Copied
I haven't tested this, but you should be able to rearrange it slightly, like this:
num = (thisComp.layer("Null 19").effect(1)(1)[0]).toFixed(2);
function addCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");
}
txt = addCommas(num);
var fontArray=[
"BerninaSansOffc-Regular",
"DTFlowTextV1.011-Regular"
]
v=Math.round(thisComp.layer("Null 19").effect("Font CTRL")("Slider"))
style.setFont(fontArray[v]).setText(txt);
Copy link to clipboard
Copied
thank you so much @Dan Ebberts that works perfect!