• Global community
• Language:
• Deutsch
• English
• Español
• Français
• Português
• 日本語コミュニティ
Dedicated community for Japanese speakers
• 한국 커뮤니티
Dedicated community for Korean speakers
Exit
• I create an number up After effects expression fro...

# I create an number up After effects expression from 1000 to 1K but I need to use 2 digit decimal

New Here ,
Jul 10, 2023 Jul 10, 2023

Copied

Currently I use Point Control to replace slider, when I devide by 1000, all become .00:

numSlider= effect("Point Control")("Point")[0].toFixed(2);

if(numSlider>999 && numSlider<1000000){
n = numSlider/1000;
Math.floor(n).toFixed(2)+"k"
}
else if(numSlider>1000000){
m = numSlider/1000000;
Math.floor(m).toFixed(2)+"M"
}
else(numSlider)
TOPICS
Expressions , Scripting

Views

99

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
3 Replies 3
LEGEND ,
Jul 10, 2023 Jul 10, 2023

Copied

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 Expert ,
Jul 10, 2023 Jul 10, 2023

Copied

Like this maybe:

``````numSlider= effect("Point Control")("Point")[0];
dec = numSlider.toFixed(2).substr(-3);
if (numSlider >= 1000000){
Math.floor(numSlider/1000000) + dec + "M";
}else if (numSlider >= 1000){
Math.floor(numSlider/1000) + dec + "k";
}else{
numSlider.toFixed(2);
}``````

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Jul 11, 2023 Jul 11, 2023

Copied

LATEST

Thanks guys for the reply. I found my solution.

numSlider= Math.round(effect("Point Control")("Point")[0]);

if(numSlider>999 && numSlider<1000000){
n = (numSlider/1000);
digit = 2;
coma= Math.floor(numSlider/Math.pow(10,digit-1))%100;
Math.floor(n)+"."+coma+"k"
}
else if(numSlider>1000000){
m = numSlider/1000000;
digit1 = 5;
coma1= Math.floor(numSlider/Math.pow(10,digit1-1))%100;
Math.floor(m)+"."+coma1+"M"
}
else(numSlider)