-
Keyframing Parenting
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.positioni 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;}
}
Sorry, there were no replies found.