Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Keyframing Parenting

  • Keyframing Parenting

    Posted by Francois Germain on March 13, 2015 at 8:54 pm

    Hi guys. I’ve look if it was possible to keyframe parenting. Actually, it doesn’t need to be a real parenting link beetween 2 objects. Just act like it. In fact I just need a position link. So I made that expression but there’s a glitch. It triggers parenting but when I turn it off, the child gets back to it’s original position.

    So here’s how it works:
    the child layer has a checkbox expression control.
    the expression is in the transform.position

    i guess the solution is in the last 2 lines, but I can’t find it.

    thanks

    newPos=transform.position;

    objetA=thisComp.layer("Master");
    objetB=thisLayer;

    if (objetB.effect("Checkbox Control")("Checkbox")==true) {

    if (objetA.transform.position[0]>objetB.transform.position[0])
    { Xsign=-1}
    else
    {Xsign=1}
    if (objetA.transform.position[1]>objetB.transform.position[1])
    { Ysign=-1}
    else
    {Ysign=1}

    t1=objetB.effect("Checkbox Control")("Checkbox").key(2).time;
    lockOn=valueAtTime(t1);

    distX=length(objetA.transform.position.valueAtTime(t1)[0],objetB.transform.position.valueAtTime(t1)[1]);
    distY=length(objetA.transform.position.valueAtTime(t1)[1],objetB.transform.position.valueAtTime(t1)[1]);

    newPosX=objetA.transform.position[0]+(distX*Xsign);
    newPosY=objetA.transform.position[1]+(distY*Ysign);
    newPos=[newPosX,newPosY];
    newPos

    }else{
    if (time<=0){
    newPos=transform.position}
    else{

    PositionPause=objetB.transform.position.valueAtTime(time);
    newPos=PositionPause;}
    }

    Francois Germain replied 11 years, 1 month ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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