Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Access Time property of a child composition

  • Access Time property of a child composition

    Posted by Shin Huynh on April 16, 2019 at 10:18 am

    i would like to change the position of a composition A every time the time in composition B hit 1s , 2s , 3s ,…
    A and B are in the same composition ,
    how to access the time of the B comp ; sorry i’m very new to expression , i tried
    thisComp.layer(“B”).time
    but it did not work
    please , help me

    thisComp.layer("B").time

    Kalleheikki Kannisto replied 7 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    April 16, 2019 at 3:10 pm

    This should give you the basic idea for moving layer B after layer A starts. Position expression for layer “B” :

    A = thisComp.layer("A")
    myTime = A.time-A.inPoint;
    myPlaceX = 1000+Math.max(100*Math.floor(myTime),0);
    myPlaceY = 500+Math.max(50*Math.floor(myTime),0);
    [myPlaceX, myPlaceY]

    Math.max is used to ensure we start at 0, not in the negative range.
    Math.floor is used to move only at full seconds.
    inPoint is the time at which the layer starts.

    Layers A and B are in the same level of hierarchy here, though. Although it doesn’t sound like you have it set as a child comp, if you did have a comp named “B Comp” within which you have a layer named “B”, it would be this way instead:

    A = comp("B Comp").layer("B")
    myTime = A.time-A.inPoint;
    myPlaceX = 1000+Math.max(100*Math.floor(myTime),0);
    myPlaceY = 500+Math.max(50*Math.floor(myTime),0);
    [myPlaceX, myPlaceY]

    (I have the layers “A” and “B” kinda reversed there…)

    Kalleheikki Kannisto
    Senior Graphic Designer

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