max and min value expression ..

Scripting for After Effects

max and min value expression ..

Postby ali_hussain on 09/28/2015, 9:11 am

hello , Im using delay expression to animate everything automatically depending on its layer number " index " .

delay = thisComp.layer("Null 92").effect("delay")("Slider");
d = delay*index;
t = time-d;
x = thisComp.layer("Null 92").effect("scale")("Slider").valueAtTime(t);
[x,x];

lets say i have 2 squares shapes and one of them is [100,100] and the other one was [40,30] how can I apply this expression with out doing this

delay = thisComp.layer("Null 92").effect("delay")("Slider");
d = delay*index;
t = time-d;
x = thisComp.layer("Null 92").effect("scale")("Slider").valueAtTime(t);
[x-60,x-70];

that could work with two squares but imagine working with 20 and they have round numbers it really hard to do the math for each single element

Im not an expert , I just started using expression so can someone help me and thanks in advance.
ali_hussain
 
Posts: 36
Joined: 10/24/2014, 12:39 pm

Re: max and min value expression ..

Postby ali_hussain on 09/28/2015, 10:40 am

Image

i kind of solve it but its not working with the rotation .

any ideas ..
ali_hussain
 
Posts: 36
Joined: 10/24/2014, 12:39 pm

Re: max and min value expression ..

Postby star+circle on 09/29/2015, 12:40 am

ali_hussain wrote:lets say i have 2 squares shapes and one of them is [100,100] and the other one was [40,30] how can I apply this expression with out doing this
...
[x-60,x-70];


Well, this is raising a few questions:

What is the purpose of this calculation on the last line? It works with the [x,x]. Or do you want to make the layers the same final size regardless of their original size?

Also, with orientation, what is the purpose of the last line of the expression? The objects will follow the rotation set by the slider if you take it out.

And why is the thread about "min and max expression"?
star+circle
 
Posts: 773
Joined: 12/6/2014, 3:07 pm
Location: Finland

Re: max and min value expression ..

Postby Mylenium on 10/4/2015, 12:36 am

ali_hussain wrote:it really hard to do the math for each single element


No, it isn't. Scale is just an abstract value and you need to use it as a multiplier, not add or subtract stuff.

Mylenium
[Pour Mylène, ange sur terre]
----------------------------------------
www.myleniumblog.com
Mylenium
 
Posts: 3263
Joined: 02/1/2009, 11:45 am
Location: Germany
System Specs: Have, I do!

Re: max and min value expression ..

Postby star+circle on 10/5/2015, 10:55 am

As far as I can tell, the expressions should work if you simply take the last lines with the linear expression out. (Or, in the case of two-dimensional values like 2D scale, use [x,x] as the last line.)
star+circle
 
Posts: 773
Joined: 12/6/2014, 3:07 pm
Location: Finland


Return to After Effects Expressions