3 people found this helpful
If you want 1 decimal in all situations, even if the number is an integer, use effect("Slider Control")("Slider").value.toFixed(1);
x = effect("Slider Control")("Slider");
This gives me 1 decimal place which is great, was finding that hard, but not "40.0" so the "%" sign I have on the end moves around.
Maybe .valuetoFixed is deprecated in newer CC versions?
Or maybe I am just stupid!
You need to append the string and possibly build it manually. Something like this perhaps:
if (mLength < mDigits)
Sorry, saw your question late.
In effect("Slider Control")("Slider").value.toFixed(1); there is a dot (.) between "value" and "toFixed",
ie it's not valuetoFixed(1) but .value.toFixed(1).
Align your text box right - then the % will stay in the same place. The numbers to the left will continue to move though.
Er, exactly. Obviously i thought of that. Uber number is the best way, once you have added sliders to it and saved a preset.
Ultimately i guess the best thing is to use a separate text layer for each integer, scripted to show either tens, hundredths etc. That could be centrally aligned so not move. Might try on Monday just for kicks
there is much easy way to do this: Math.round(effect("Slider Control")("Slider"))/10
Er n no kornbif, that is just a tiny part of this, already discussed.
So i finally did this the other day.
It is funny how nobody else either understood there was a problem, or offered the solution.
Now i can build counters with any font.
You need a seperate layer for each integer.
You need to pick which number in sequence it is, missing out decimal points.
It is the only way to keep the number still.
I'll see if i can share it when i go back to work.
the easiest expression I've found to do this is this:
the number at the end of the expression defines the number of decimal places.