14 Replies Latest reply on May 8, 2018 7:58 AM by Паныч

# Slider Decimal Place

I am using the slider tool to blur a set of numbers up from 0 to 2.9. Initially, I had the issue that the numbers entered had four decimal places  (ex. 2.1253 ) I only needed one decimal place. I found this expression to round up.

Math.round(effect("Slider Control")("Slider"))

Unfortunatey, this shows no decimal places and I need to just show one decimal place but cannot find an expression online that is word for word the expression I need.

Basically I need to go to the tenth decimal place. so from 0 to 2.9, does anyone know the exact expression for this?

• ###### 1. Re: Slider Decimal Place

If you want 1 decimal in all situations, even if the number is an integer, use effect("Slider Control")("Slider").value.toFixed(1);

Otherwise:

x = effect("Slider Control")("Slider");

Math.round(10*x)/10;

Xavier.

• ###### 2. Re: Slider Decimal Place

HI

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!

• ###### 3. Re: Slider Decimal Place

You need to append the string and possibly build it manually. Something like this perhaps:

mSlider=effect("XYZ")("Slider");

mDigits=4;

mValue=mSlider.toString();

mString=mValue.toFixed(1);

mLength=mString.length;

if (mLength < mDigits)

{oString=mString+".0"}

else

{oString=mString}

[oString]

Mylenium

• ###### 4. Re: Slider Decimal Place

Using  Quba for now.

Quba HQ » QHQ ÜberNumber (Tutorial + Preset)

• ###### 5. Re: Slider Decimal Place

Alternatively, the counter iExpressions from the Source Text Bundle also offer easy and flexible formatting of numbers:

Counter Numbers Expression | mamoworld

• ###### 6. Re: Slider Decimal Place

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).

Xavier

• ###### 7. Re: Slider Decimal Place

Align your text box right - then the % will stay in the same place. The numbers to the left will continue to move though.

• ###### 8. Re: Slider Decimal Place

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

• ###### 9. Re: Slider Decimal Place

there is much easy way to do this: Math.round(effect("Slider Control")("Slider"))/10

• ###### 10. Re: Slider Decimal Place

Hi

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.

• ###### 11. Re: Slider Decimal Place

the easiest expression I've found to do this is this:

effect("Slider Control")("Slider").value.toFixed(1)

the number at the end of the expression defines the number of decimal places.

• ###### 12. Re: Slider Decimal Place

Its great. Now the number will goes like this 7.8, 7.9, and 8.
How to make it to 8.0. Which iI need the "0".

• ###### 13. Re: Slider Decimal Place

USE uberNUmber!

really

it has all the options you would need.

(apart from keeping any font centred, see above!)

let's you set decimal place and leading zeros.

• ###### 14. Re: Slider Decimal Place

effect("Slider Control")("Slider").value.toFixed(1)

the number at the end of the expression defines the number of decimal places.