Activity › Forums › Adobe After Effects Expressions › How to get a slider value to stay to 2 decimal places in a text layer?
-
How to get a slider value to stay to 2 decimal places in a text layer?
Posted by Dave Martin on October 8, 2012 at 6:33 amI’m using sliders to input values for ‘Source text’ in text layers.
I want to have the text display a value to 2 demimal places: I.E. “1.20” and NOT “1.2”
Any ideas guys?
Thanx 🙂
Dustin Ward replied 12 years, 12 months ago 3 Members · 9 Replies -
9 Replies
-
Dan Ebberts
October 8, 2012 at 3:10 pmLike this:
thisComp.layer(“other layer”).effect(“Slider Control”)(“Slider”).value.toFixed(2)
Dan
-
Dave Martin
October 17, 2012 at 4:55 pmSorry for not getting back sooner Dan…
But, Thanks… Just what I needed.
-
Dustin Ward
July 29, 2013 at 7:40 pmThanks for this info,
How would I get it to show any numbers besides zeros after the decimal? For example: 1.86-9.63 instead of 1.00-9.00 -
Dan Ebberts
July 29, 2013 at 7:54 pmThat’s what it does. If the slider is set to 1.6578, the expression should display 1.66. Maybe I’m not understanding the question.
Dan
-
Dustin Ward
July 29, 2013 at 10:19 pmhmm… yeah, that’s what I thought the expression was as well. When I apply the expression, I only get zeros after the decimal. Maybe I’m just doing something wrong.
-
Dan Ebberts
July 29, 2013 at 10:26 pmI’m assuming the slider value has something other than zeros, is that correct?
-
Dustin Ward
July 29, 2013 at 10:42 pmNo, it is only showing zeros after the decimal. Sorry, I should have clarified that.
-
Dan Ebberts
July 29, 2013 at 10:45 pmThe text layer is only going to show zeros if the slider is parked on a whole number. Have you tried setting the slider to some other value?
Dan
-
Dustin Ward
July 29, 2013 at 10:51 pmOk, I figured it out. When a slider is on a solid it only has zeros after the decimal. If it’s on a text layer it has all the numbers after the decimal.
Reply to this Discussion! Login or Sign Up