Skip to main content
Participant
November 12, 2017
Answered

AE 2018 Math function

  • November 12, 2017
  • 1 reply
  • 2523 views

Hi All,

Appreciate some help for a newbie.

I am using the text slider function on Comp 1.

in the source text I have the expression effect("Slider Control")("Slider").value.toFixed(0,)

this works no problem.

What I am trying to do is have the number displayed only increase in increments of 10. so example if its 15 then its 20 but if its 14 its 10.

I have found many expressions, however I cannot make any work, either I'm using the wrong syntax or the wrong location.

Appreciate if someone can tell me exactly where the expression is put and what it says.

thanks

This topic has been closed for replies.
Correct answer Dan Ebberts

Try it this way (all in the same expression):

s = effect("Slider Control")("Slider").value;

Math.round(s/10)*10

Dan

1 reply

Mylenium
Legend
November 12, 2017

Easy as pie - divide the number by yor quantization value, round it, multiply it again with your value. Example:

Math.round(Slider/10)*10

Simple 5th grade math.

Mylenium

kingohkAuthor
Participant
November 12, 2017

Thanks Mylenium,

sadly my knowledge of where to put it is lower then 5th grade..

is it

effect("Slider Control")("Slider").value.toFixed(0,);

Math.round(Slider/10)*10

all in the same expression ? this is where I'm having the most difficulty.

thanks

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
November 12, 2017

Try it this way (all in the same expression):

s = effect("Slider Control")("Slider").value;

Math.round(s/10)*10

Dan