Forums › Adobe After Effects › Font size and leading expression
-
Font size and leading expression
-
Alex Nirenberg
July 25, 2021 at 12:48 amHi guys, I’m having some issues with a code.
I set up a code that controls font size and leading size with 2 sliders.
The problem that it works only on one of them. If I place the font size at the bottom it’s the one that works. And if I put the leading one at the bottom it’s the one that works. Please help!var x = effect(“font-size”)(“Slider”).value;
var y = effect(“line-space”)(“Slider”).value;
if ( x == 2) {style.setFontSize(50)}else {style.setFontSize(100)};
if ( y == 1) {style.setLeading(100)}else {style.setLeading(50)};
-
Graham Quince
July 28, 2021 at 9:35 amLooks like the styles need to be on the same line. Try this:
var x = effect("font-size")("Slider").value;
var y = effect("line-space")("Slider").value;
var myfontsize = 50;
var myleading = 100;
if ( x != 2 ) {
myfontsize = 100;
}
if ( y != 1 ) {
myleading = 50;
}
style.setFontSize(myfontsize).setLeading(myleading);
Log in to reply.