Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression help. Postition of another layer retimed

  • Expression help. Postition of another layer retimed

    Posted by Xavier De champs on March 25, 2009 at 2:15 pm

    I want to link a layer to a parent. But I want the child-layer to be offset in time. Meaning: When parent-layer is at frame 12 I want child-layer to be at same spot as parent layer was at frame 5. Like a time-delay?

    I want to use this simple expression to make a simple spring like expression. I have tried some variants of the Ebberts spring expression, but I drags my system to a halt when I chain-link several layers together. I just need very subtle spring-like movement, which I think that this time-delay-expression will give me.

    Can anyone help?

    All the best .)

    Xavier De champs replied 17 years, 1 month ago 2 Members · 6 Replies
  • 6 Replies
  • Kevin Camp

    March 25, 2009 at 2:33 pm

    if you want everything to have the spring motion but just each piece offset in time, then apply the spring expression to the ‘leader’ (we probably shouldn’t call this the ‘parent’ since we won’t use ae’s parenting system).

    then you can use a valueAtTime function to offset the follower layers, something like this:

    leader = thisComp.layer(“Leader”).transform.position; // this need to be pointed at your ‘leader’
    offset = 12; // offset in frames
    leader.valueAtTime(time-(offset*thisComp.frameDuration*(index-leader.index)))

    the expression will multiply the follower layer’s index by the offset amount so each follower will be offset further than the previous… it does expect that the follower layers will be bellow the leader, if the follower layers are above, they will precede the leader…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Xavier De champs

    March 25, 2009 at 2:57 pm

    Sounds like a great idea, that I can use. But I get this error message:

    After Effects warning: Class ‘Property’ had no property or method named ‘index’
    Expression disabled.

    Error occurred at line 3.

    I don’t understand programming language that well, so I have no clue.

  • Kevin Camp

    March 25, 2009 at 3:38 pm

    well, ‘index’ is the layer’s order number in the composition… the top most layer has an index of 1, the next has an index of 2, etc…

    what version of ae are you using? it may be that older versions didn’t have the ‘index’ object defined.

    you could also try a reboot… a few times i’ve had ae give me errors in simple expressions, and rebooting made it work properly…

    the only other thing i can think of is if you have an ae language other than english, perhaps the ‘index’ term is a different term, but i wasn’t aware of any language differences in expressions….

    without it you’d have to manually adjust the offset value for each follower expression… so 12, 24, 36, 48.. etc.

    are the follower layers identical to the leader layer, just offset in time?

    if so, you may be able to use the echo effect. you’ll need to pre-comp the leader layer (layer>pre-compose, choose to move all attributes). apply echo to the pre-comp.

    the echo time is in seconds, so you’ll need to type an equation to get the offset, type -12 divided by the frame rate, so if you’re working in 29.97 fps, type’ -12/29.97′ in the echo time property. then set the number of echoes and set the echo operator to ‘composite in back’.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Xavier De champs

    March 25, 2009 at 3:43 pm

    Oh…I see. So this expression automaticly takes into account all the layers and in which order they are situated (above or below each other).

    Well. My animation is simpler than that, and my layers are scattered above and below each other. Not in any particular order. So I just need to tweak the “offset in time” value for each layer individually. I don’t need automaticly offset according to order in which the layers are placed.

    Do you have a simpler solution for this, or do I just delete the third line?

  • Kevin Camp

    March 25, 2009 at 4:08 pm

    i caught the problem in my first expression, it should have looked like this:

    leader = thisComp.layer(“Leader”); // this needs to be pointed at your ‘leader’
    offset = 12; // offset in frames
    leader.transform.position.valueAtTime(time-(offset*thisComp.frameDuration*(index-leader.index)))

    however, if they are scattered about and you wanted to adjust the followers in points (where each layer starts in the timeline) you could try an expression like this:

    leader = thisComp.layer(“Leader”); // this needs to be pointed at your ‘leader’
    offset = inPoint – leader.inPoint;
    leader.transform.position.valueAtTime(time-offset)

    it won’t use the index of the layer to adjust the offset, but rather the in point of the layer in respect to the in point of the leader layer.

    or you can manually adjust the offset with an expression like this:

    leader = thisComp.layer(“Leader”); // this needs to be pointed at your ‘leader’
    offset = 12 // offset in frames;
    leader.transform.position.valueAtTime(time-(offset*thisComp.frameDuration))

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Xavier De champs

    March 25, 2009 at 6:46 pm

    Great, thanx! It seems to work for me now.

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