Copy link to clipboard
Copied
Hi, i'm stuck in this problem and maybe it's just a simple trick.
I need a way to make a countdown of a price with baseline shift on the two last numbers. The price should go from 22,25 to 19,95.
If i use slider control with the expression: Math.round(effect("Slider Control")("Slider")) - i can't format the text to baseline shift.
Copy link to clipboard
Copied
Yes, any formatting of individual letters gets lost if you apply an expression to the source text. This happens for all expressions and not specific to the Math.round. Hence, the only solution is probably to split this into two separate text layers.
Copy link to clipboard
Copied
Hi Mathias
I thought so, but my problem is how to make the counter in two separate text layers?
Copy link to clipboard
Copied
use this to get the number without fractions
var val = effect("Slider Control")("Slider"); // pick whip slider here
Math.floor(val)
and this to only get the fractions:
var val = effect("Slider Control")("Slider"); // pick whip slider here
var result = (val%1+"").substr(2,2);
while (result.length < 2) result= result +"0";
result
In general, for complex counters I highly recommend my iExpressions Counters:
https://mamoworld.com/after-effects-expression/counter-numbers
Copy link to clipboard
Copied
Hmm, it counts...
But the amount doesn't follow the fractions when it passes zero. I need to countdown from 22,25 to 19,95.
Copy link to clipboard
Copied
oops, must be Math.floor(val) instead of Math.round(val)
I corrected it in the answer above.