Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions combining 2 things

  • combining 2 things

    Posted by Gunnar Kordestani on December 22, 2007 at 7:52 am

    hello everybody,

    I want to apply to the z-position of a Layer

    1. same values as the layer above, but a little less >
    2. same values as the layer above, but a little later

    1.

    x=position[0];
    y=position[1];
    z=thisComp.layer(index-1).transform.position[2]/.9;
    [x,y,z]

    2.

    x=position[0];
    y=position[1];
    z=thisComp.layer(index-1).transform.position.valueAtTime(time-1);

    these expression do either one of the desired things, but I can’t figure out, how to combine them…

    how would you do?

    also I wonder, why in the second one the ending [x,y,z] is not accepted but requiered in the first.

    thanks

    Gunnar Kordestani replied 18 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    December 22, 2007 at 8:47 am

    Hi Gunnar,

    combing the two would be:

    x=position[0];
    y=position[1];
    z=thisComp.layer(index-1).transform.position.valueAtTime(time-1)[2]/.9
    [x,y,z]

    your second question:
    since you only want to change the z-part of the position value, the x, y and z are stored separately as numbers, then recombined as a list with 3 values.
    That is what the position property of a 3d layer expects as the result of an expression: [x,y,z]

    In your second example, you’ll see that in the variable z you were actually storing the entire position variable, not just the z component. [2]

    Sticking that in an array would give something like [x,y,[x2,y2,z2]], and you would get an error.

  • Gunnar Kordestani

    December 22, 2007 at 2:52 pm

    that’s it, great!

    thanks a lot !

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy