Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to offset Z axis by layer number

  • Expression to offset Z axis by layer number

    Posted by Dan Marker on September 19, 2007 at 7:45 pm

    I used to know a code that I could use to make 3D text add z-depth… basically it would figure out the leyer number and somehow translate that into a z position offset and then I could just duplicate the layer to a desired z-depth

    anyone know what this expression is?

    thanks
    dan

    Martin King replied 15 years, 3 months ago 4 Members · 4 Replies
  • 4 Replies
  • Pdebster

    September 19, 2007 at 8:22 pm

    Hi Dan,
    I’m sure the renowned Mr. Ebberts has a more elegant solution, but this has worked for me in the past when ‘extruding’ in Z:

    1. make a solid that acts as your base layer
    2. add a ‘child’ layer directly above the base layer that you wish to offset in z
    3. to the position property of the child, add:
    offset = 10; //you may want to drive this with a slider
    p = thisComp.layer(“base”);
    offsetInterval = Math.abs(index – thisComp.layer(“base”).index);
    [p.position[0], p.position[1], p.position[2] + (offset*offsetInterval)];

    then duplicate your child to your heart’s content.

    hope that is what you were looking for (or in the ballpark),
    pdebster

  • Dan Marker

    September 19, 2007 at 10:02 pm

    perfect… thanks for the help

  • Jean-lou Roy

    March 1, 2010 at 3:42 pm

    Thanks! These few lines of code were really helpful! JL

  • Martin King

    February 18, 2011 at 3:56 pm

    How about the following:

    [position[0], position[1],0.5* thisLayer.index];

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