ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

problem to keep zero after comma with math.round

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Plamen Benev
problem to keep zero after comma with math.round
on Sep 7, 2018 at 7:40:25 pm

I have a expression that i want to round number with one symbol after the comma ( 0.6 , 12.6, 78.9 etc) and I want the number after the comma to always be displayed. May problem is that when the numbers start to spin sometimes number after comma dissapear ( example: shows me 23; 46 ... but i want 32.0 ; 46.0) causing the whole number to move which is an unpleasant visual effect.

I will be very happy if someone can show me where I'm wrong.

Thanks.

My expression look like this:
startCount = 0.0;
endCount = comp("Final_data").layer("Finall Data").effect("b1")("Slider");
countDur = 1,5;
Math.round(linear(time,0,countDur,startCount,endCount)*10)/10


Return to posts index

Dan Ebberts
Re: problem to keep zero after comma with math.round
on Sep 7, 2018 at 9:51:56 pm

Try changing the last line to this:

linear(time,0,countDur,startCount,endCount).toFixed(1)


Dan



Return to posts index

Plamen Benev
Re: problem to keep zero after comma with math.round
on Sep 8, 2018 at 8:56:53 am

Hi, Thanks, but problem still persists. I need to have the visible null after comma when digit is round.
Do you have other solution?


Return to posts index


Dan Ebberts
Re: problem to keep zero after comma with math.round
on Sep 8, 2018 at 5:28:06 pm

It works perfectly for me:

startCount = 0.0;
endCount = comp("Final_data").layer("Finall Data").effect("b1")("Slider");
countDur = 1,5;
linear(time,0,countDur,startCount,endCount).toFixed(1)

Round numbers display as:

0.0
1.0
etc.


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]