FORUMS: list search recent posts

expression reading output of expression and misc questions regarding this

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ross Klettke
expression reading output of expression and misc questions regarding this
on Dec 18, 2012 at 5:49:28 pm

I've always avoided using the output of one expression as an input into another expression, though I see that it is possible...

Example:
Layer 1, with an expression on its xPos: Math.sin(time)

and Layer 2, with an expression on its xPos: thisComp.layer("Layer 1").transform.xPosition

------

Is this sort of practice something that should be avoided or, if it is worthwhile in certain cases, are there any pitfalls to be aware of? Is there any way I can order the layers to speed up evaluation of the expressions? (Letting AE know that Layer 1 should be evaluated first and then Layer 2)

Would putting this expression on Layer 2--
thisComp.layer("Layer 1").transform.xPosition.valueAtTime(time - framesToTime(3));
-- cause any additional concerns?

Additionally, let's say that there are keyframes on Layer 1's xPos -- can Layer 3 access Layer 1's xPos value before the expression's output masked it? (the keyframe data and not the output of the expression on Layer 1's xPos)

------

If the above is okay, I imagine a cycle is still always a bad idea?

Example:
Layer 4, with an expression on its xPos: thisComp.layer("Layer 5").transform.xPosition * -1

and Layer 5, with an expression on its xPos: Math.sin(time * 2) * 50 + thisComp.layer("Layer 4").transform.xPosition;

------

Thanks!
--Ross


Return to posts index

Dan Ebberts
Re: expression reading output of expression and misc questions regarding this
on Dec 18, 2012 at 10:01:36 pm

>Is this sort of practice something that should be avoided

There could be a potential performance issue if you had a long chain of expressions where, for example, each expression references the same property in a previous layer. There are usually ways to avoid that.

> can Layer 3 access Layer 1's xPos value before the expression's output masked it?

Not directly. There is an obscure work around where Layer 1 can "publish" it's pre-expression value in negative time like this:

if (time < 0){
valueAtTime(-time);
}else{
(regular expression goes here)
}

Then another layer could do something like this:

thisComp.layer("Layer 1").transform.xPosition.valueAtTime(-time)

Since there is no negative time zero, you may have to add special code to handle that.

>I imagine a cycle is still always a bad idea?

I think in best of circumstances the outcome may be unpredictable, so I'd avoid it.


Dan



Return to posts index

Ross Klettke
Re: expression reading output of expression and misc questions regarding this
on Dec 18, 2012 at 10:06:49 pm

Awesome, thanks Dan! And that "publish"-to-negative-time workaround is really interesting.


Return to posts index

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