Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help combining 2 expressions – number counter with point controll + font change

New Here ,
Feb 06, 2023 Feb 06, 2023

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)

 

TOPICS
FAQ , How to , Scripting
256
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2023 Feb 06, 2023

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);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 06, 2023 Feb 06, 2023
LATEST

thank you so much @Dan Ebberts  that works perfect! 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines