Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Issue with animated parents

  • Issue with animated parents

    Posted by Bryan Woods on March 29, 2016 at 5:45 pm

    Hey there, I’m working on writing an expression to animate parents between layers and I have an issue I’m not understanding.

    Scenario:
    Two layers, child and a parent. My expression is going into the position value of the child. Child has a check box and a layer control drop down.

    Issue:
    with my current code (pasted below), things are working well, but I have one small issue. I can animate the code to work when its checked on, but once I do that, the child snaps to the position of the parent, wherever it happens to be, instead of moving with the parent regardless of where it initially started. I’m guessing I have to calculate the position at the current time for the parent or something, but not sure how to go about doing that.

    I’m sure this has been posted before, so if its easier to direct me to a previous thread, please do. Thanks!

    myParent = effect("Layer Control")("Layer");
    myProp = myParent.transform.position;
    boole = effect("Checkbox Control")("Checkbox");

    if(boole==1){
    value + (myProp.value - myProp.valueAtTime(0));
    }else{
    value;
    }

    Dan Ebberts replied 10 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 29, 2016 at 6:29 pm

    I’m not exactly sure what you’re trying to do, but if you want to animate the checkbox so that the child follows the parent when the box is checked and holds its position when the checkbox is off, your expression will need to look at all previous checkbox keyframes and add up the total distance the parent traveled for all previous segments where the check box was on. Then, if the checkbox is currently on, add the amount of travel so far for the current segment. Definitely do-able, but a bit of work.

    Dan

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