Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Slider Decimal Place

New Here ,
Nov 17, 2013 Nov 17, 2013

Copy link to clipboard

Copied

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?

TOPICS
Expressions

Views

78.6K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 19, 2013 Nov 19, 2013

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 29, 2015 Oct 29, 2015

Copy link to clipboard

Copied

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 29, 2015 Oct 29, 2015

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 29, 2015 Oct 29, 2015

Copy link to clipboard

Copied

Head just exploded Scanners style...

Using  Quba for now.

Quba HQ » QHQ ÜberNumber (Tutorial + Preset)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 29, 2015 Oct 29, 2015

Copy link to clipboard

Copied

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

counter_numbers_0.png

Counter Numbers Expression | mamoworld

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

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

Xavier

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 25, 2016 Nov 25, 2016

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 25, 2016 Nov 25, 2016

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 20, 2021 Sep 20, 2021

Copy link to clipboard

Copied

LATEST

I found an easy way to set this up.  

In addition to the data sliders,  I created a slider called "precision", which will have values like 1,2,3,...

This allows you to control the precision of data from mulitple sliders with top-level control


I use the pow() function to convert to powers of 10

precision= 1 rounds to 1 decimal place,  precision= 2 rounds to 2 decimal places, etc

full expression:

x=Math.round(thisComp.layer("CONTROL_LAYER").effect("precision")("Slider"))
x=Math.pow(10,x)
Math.round(thisComp.layer("DATA_LAYER").effect("slider_name")("Slider")*x)/x

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 22, 2017 Dec 22, 2017

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 23, 2017 Dec 23, 2017

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2018 Jan 10, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

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

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines