Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using an expression to refer to to a layer above its own layer in the timeline.

  • Using an expression to refer to to a layer above its own layer in the timeline.

    Posted by Christopher Rutherford on February 20, 2020 at 7:45 pm

    Hey all,

    currently daisy-chaining a bunch of layers so they stack automatically based on their shape sizes. Expression used on layer A is currently “thisComp.layer(“Layer B”).sourceRectAtTime().height” and on layer B it’s “thisComp.layer(“Layer C”).sourceRectAtTime().height” and so on.

    Wondering if there was an expression that would make it such that reordering the layers in the timeline would update their position in the stack. My initial thought was using the layer index, but I couldn’t figure out a way to make it refer to the layer immediately above it in the timeline.

    Adrian Almonte replied 6 years, 6 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    February 20, 2020 at 8:26 pm

    You can do math on the layer’s index to get to the layer above, like this:

    thisComp.layer(index-1)

    Or you can use relative indexing, like this:

    thisComp.layer(thisLayer,-1)

    but, you can’t change the actual stacking order with an expression. It wasn’t clear to me if you understood this. Sorry if you did. You could shuffle them in Z space if they are 3D layers though.

    Dan

  • Christopher Rutherford

    February 20, 2020 at 11:01 pm

    The relative indexing is exactly what I was looking for. Mr. Ebberts, you’ve done it again.

  • Adrian Almonte

    February 21, 2020 at 5:42 am

    Hey all,

    Is it possible to use this same expression for a mobile text conversation, without any key frames, as well?

    The “text message” would be placed in a pre-composition. All of the pre-comped text messages would be placed in one composition.

    Can the pre-compositions, that are sequenced/spread 10 seconds apart, call to the Current Time Indicator to determine and allow the pre-compositions to be animated to it’s dedicated position?

    See image attached as referenced

    Thank you for your help

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