ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Get the completion of a slider

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marjon Le Roy
Get the completion of a slider
on Apr 20, 2020 at 9:34:04 am

Hi,

I have been checking the forum for years and learned a lot! So thanks to everyone!

So my situation:
I have a slider with the value ranging from 70 to 100. Now I want to know the position on the slider so I can use it in my expressions. So I want the starting value (70) to be 0% and the end position (100) 100%;
But I can't figure it out. Does anybody have an idea how to solve this?

Thanks in advance!


Return to posts index

Dan Ebberts
Re: Get the completion of a slider
on Apr 20, 2020 at 2:46:53 pm

Maybe something like this:

s = thisComp.layer("Control").effect("Slider Control")("Slider");
pct = linear(s,70,100,0,100) + "%";


Dan



Return to posts index

Marjon Le Roy
Re: Get the completion of a slider
on Apr 20, 2020 at 3:16:10 pm

Thanks for the help Dan!
I dove into some math last couple of hours and just figured it out myself. And it is actually quit easy.

For those who want to know how I solved it, this is the formula:
((slider value - start value)/(end value - start value))*100

So my expression looks like this:

slider = thisComp.layer("Control").effect("Slider Control")("Slider");
p = ((slider - 70)/(100-70))*100;


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]