Forums › Adobe After Effects Expressions › Combining 2 Expressions
-
Combining 2 Expressions
-
Patrick Schmid
February 6, 2023 at 11:39 pmHi,
im doing a a UI animation and i have to deal with a lot of numbers over 1.000.000
so i tried to make a counter with a point Control which worked fine.
but i also need the possibility of decimals…?
with the second Expression i try to to change the font.
can anybody please help me combine these two + the extra with the decimals 🙂
1st Expression:
num = Math.round(effect(“Point Control”)(“Point”)[0]);
function addCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g,”,”);
}
addCommas(num)
2nd Expression:
var fontArray=[
“BerninaSansOffc-Regular”,
“DTFlowTextV1.011-Regular”
]
v=Math.round(thisComp.layer(“Null 19”).effect(“Font CTRL”)(“Slider”))
style.setFont(fontArray[v]);
-
Tomas Bumbulevičius
February 9, 2023 at 9:42 amYou can add decimal by supplementing your expression by “.toFixed(X)” where X is number of decimals.
Once you change the font, you need to “.setText(YOUR_TEXT_VARIABLE)” in the style expression
Log in to reply.