FORUMS: list search recent posts

Expression Translation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Isaac Borjas
Expression Translation
on Oct 27, 2012 at 12:03:46 am

ok here is my question,
I wanna create an expression relative to the one belove to use in after effects and this is the code base on different but similar code base of after effects:

Actmove = 0;
if (effect("XFaceR")("X") >= 45)
{Actmove=1;}
else if ((effect("XFaceR")("X") <= -22)
{Actmove=0;}

Rvalue=0;
if (Actmove=1) {Rvalue = time*slidercontrolValue;}
else {Rvalue = time*(slidercontrolValue+slidervalue2);}

value+Rvalue;
--------------------------------------------------------------------

Actmove is a Variable

(effect("XFaceR")("X")) where (XFaceR) is the Layers Name and (X) is the X value of that layer.

slidercontrolValue = a Silder Control that will be place in a Null Object so i can keyframe it or do other things with it.

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

now how to get something similar to use in After Effects? I have try this way but no luck..


Thanks in advance.


Return to posts index

Dan Ebberts
Re: Expression Translation
on Oct 27, 2012 at 12:40:32 am

One thing that jumps out is this:

if (Actmove=1)

should be like this:

if (Actmove==1)

Dan



Return to posts index

Isaac Borjas
Re: Expression Translation
on Oct 27, 2012 at 2:30:17 am

Hi Dan,
nop that really it not it, i try it that way too always getting an error, but i'm sure is cuz that way wasn't meant for After Effects, so that why i'm looking for help on some sort of Translation of that code into After Effects expressions.


Return to posts index


Dan Ebberts
Re: Expression Translation
on Oct 27, 2012 at 6:00:16 am

That expression already is in After Effects syntax (except for the error I mentioned), but "XFacer" is an effect, not a layer and the variables "sliderControlValue" and "slidervalue2" are never defined (they should probably be linked to Slider Controls).

If you want the x positon of a layer, it would be like this:

thisComp.layer("layer name goes here").transform.position[0]

Where did you get the expression?

Dan



Return to posts index

Isaac Borjas
Re: Expression Translation
on Oct 27, 2012 at 3:14:05 pm

well that kinda weird cuz i try that way and even fixing it the way you told me and still not working, by the way my mistake that a effect X Rotation not a Layer name, The " sliderControlValue " and " slidervalue2" are goin to be linked to a 2 different Slider Control indeed.

well the code i wrote in the first post, is just base in a different language which i have knowledge and some of the code i have wrote so far have worked pretty well except with this one.

but i guess the real question will be :
- Are Variables in AE Persistent?
- Are Variables in AE store data so can be use later? a Sample will be something similar like i wanna do :
move=0;
if Rx >= SliderControlValue {move=1;}
else if Rx <= -SliderControlValue {move=0;}


Meaning that the value of " move " is store and can be use later for different purposes?


Return to posts index

Dan Ebberts
Re: Expression Translation
on Oct 27, 2012 at 4:48:31 pm

>Are Variables in AE Persistent?

No, they aren't. There's no way for an expression to pass information to itself for use at a different time. The good news is that using valueAtTime(), your expression can go back in time and look at the conditions that existed in the past and recreate the results.

Like this:

tStart = 1;
if (sliderControlValue.valueAtTime(tStart) > 45)
move = 1
else
move = 0;

Or,

tStart = 1;
move = (sliderControlValue.valueAtTime(tStart) > 45) ? 1 : 0;



Dan



Return to posts index

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