ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Selecting specific Function depending on two sliders

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
PJ Palomaki
Selecting specific Function depending on two sliders
on Mar 21, 2018 at 5:27:05 pm

Hi,

I've got a good number of easing functions and they're named like so:

inoutQuint()
inQuint()
outQuint()

I'd like to switch between functions with two sliders, one for ease type (i.e. Quint) and another for which sided easing I want (i.e. out).

What would be the best way to choose the function using those two sliders? I tried constructing a switch statement like so:

switch (easeSelect) {
case 1:
ease = "Sine";
break;
case 2:
ease = "Quad";
break;
case 3:
ease = "Quart";
break;
case 4:
ease = "Quint";
break;
case 5:
ease = "Circ";
break;
case 6:
ease = "Expo";
break;
case 7:
ease = "Bounce";
break;
case 8:
ease = "Back";
break;
case 9:
ease = "Elastic";
break;
default:
return null;
}

switch (easeType) {
case 1:
easeType = "in";
break;
case 2:
easeType = "out";
break;
case 3:
easeType = "inout";
break;
default:
return null;
}


The problem is that I can't construct a function out of that as the ease and easeType are string variables so something like this doesn't work:

var func = easeType + ease;

Is there any other way to go around this apart from nested switches?

Cheers,
PJ

--------------------------------------------------

Freelance Cinematographer, Camera Op, Video Editor and Motion Graphics Designer

http://www.pjpalomaki.com


Return to posts index

Andrei Popa
Re: Selecting specific Function depending on two sliders
on Mar 22, 2018 at 8:08:33 am

You need the ease or you want to make the expression. Because if what you are looking for is an easy way to ease(omg, how this sounds :))) you can check this out. It's "name your own price", so you can download it free, and then pay the author if you feel like they made your life easier(i think this script will). Plus, this script is not binary encrypted, so you can also see the code. Maybe you can find your answer(or maybe more than what you are looking for) in his code. I have seen it, very clean and well commented.

Andrei
My Envato portfolio.


Return to posts index

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