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

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

New Here ,
Feb 06, 2023 Feb 06, 2023

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)

 

TOPICS
FAQ , How to , Scripting

Views

178

Translate

Translate

Report

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

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);

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

thank you so much @Dan Ebberts  that works perfect! 

 

Votes

Translate

Translate

Report

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