ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Make Scale Dependent on Particular Range of Slider

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
T.S. Miller
Make Scale Dependent on Particular Range of Slider
on Nov 14, 2017 at 9:47:23 pm

Hi there, expression wizards! I've been a long time lurker on here and have usually found solutions to my questions in existing posts; however, I'm currently stumped...

I have a slider control on an adjustment layer. When the slider value is less than or equal to 3, I'd like the scale of a shape layer to be 75%. When the slider value is between 3 and 4, I would like it to scale between 75% and 100%. When the slider value is between 4 and 5, I would like it to scale between 100% and 75%. And when the slider value is greater than or equal to 5, I would like the scale to be 75%.

I know how to get halfway there with:

temp = linear(thisComp.layer("Slider 01").effect("Slider Control")("Slider"),3,4,75,100);
[temp, temp]

Or the flip side of it with:

temp = linear(thisComp.layer("Slider 01").effect("Slider Control")("Slider"),4,5,100,75);
[temp, temp]

But I can figure out how to bring the two together or write an effective if/else for this... Any ideas? Any help appreciated!

temp = linear(thisComp.layer("Slider 01").effect("Slider Control")("Slider"),3,4,75,100);
[temp, temp]


Return to posts index

Dan Ebberts
Re: Make Scale Dependent on Particular Range of Slider
on Nov 14, 2017 at 11:06:47 pm

This should work:


s = thisComp.layer("Slider 01").effect("Slider Control")("Slider");
if (s < 4)
linear(s,3,4,[75,75],[100,100])
else
linear(s,4,5,[100,100],[75,75])



Dan



Return to posts index

T.S. Miller
Re: Make Scale Dependent on Particular Range of Slider
on Nov 14, 2017 at 11:11:04 pm

Brilliant! Thank you, Dan! In the past hour, I found myself in a rabbit hole of if/else that seemed to be going further and further off track. This is perfect.


Return to posts index

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