Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Question from the book 'The Power of Expressions'

Tagged: 

  • Question from the book 'The Power of Expressions'

    Posted by John Cuevas
    on February 24, 2022 at 4:40 pm

    I’m working my way through the book and on pages 88-90(if you have the book), is a expression to create a cascade effect on layers, sort of recreating the windows OS dock.

    All layers have a scale expression to increase scale as cursor moves close to it.

    cursor = thisComp.layer(‘CURSOR’).position;
    x = length (position,cursor);
    linear (x,0,300,[200,200],[100,100]);

    Leader layer is the bottom of the stack, and follower layers are above it and have this expression in the position parameter. (I’ve attached the project if I was unclear.)

    layerBelow = thisComp.layer(thisLayer,1);
    [layerBelow.position[0]+ layerBelow.scale[0]*0.7, layerBelow.position[1]];

    The concept I’m confused by is the (thisLayer, 1). What is happening there? I replaced that with (thisLayer.index+1) and got the exact same result, so is (thisLayer, 1) another way of referencing the index of a layer, or is this something a little different. And if it’s different, why would you use one method instead of the other? I’m just trying to wrap my head around what is happening here.

    Thanks.

    John Cuevas
    replied 2 years, 9 months ago
    2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 24, 2022 at 6:22 pm

    It gives you the same result. layer() is pretty flexible. You can give it a single argument which can be either the name or the index of the layer (which is what you did), or you can give it two arguments–first a layer object and then a relative index from that layer (which is what the book did).

  • John Cuevas

    February 24, 2022 at 7:08 pm

    Been working with AE for 20+ years and expressions are still a struggle for me. Lefebvre done a good job with his book, but some times the ‘why/how’ explanation is lacking. So thanks for dumbing that down for me. If you ever make it to Grand Rapids MI, beers on me.

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