Highlighted

expression position parent offset

New Here ,
Aug 10, 2020

Copy link to clipboard

Copied

hi

 

 when pick whiping a puppet pin to a position of other layer, the puppet pin position jumps from its original position, the way I solve this is by adding or decreasing the X,Y amount, for example:

thisComp.layer("Shape Layer 32").transform.position - [117,215]

 

instead of calculating and entering specific values is there any expression line that i can add to the end of it ...so it will move back to the original position?

 

thanks in advance,

 

 

 

Topics

Expressions

Views

54

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

expression position parent offset

New Here ,
Aug 10, 2020

Copy link to clipboard

Copied

hi

 

 when pick whiping a puppet pin to a position of other layer, the puppet pin position jumps from its original position, the way I solve this is by adding or decreasing the X,Y amount, for example:

thisComp.layer("Shape Layer 32").transform.position - [117,215]

 

instead of calculating and entering specific values is there any expression line that i can add to the end of it ...so it will move back to the original position?

 

thanks in advance,

 

 

 

Topics

Expressions

Views

55

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Guide ,
Aug 10, 2020

Copy link to clipboard

Copied

If I understand you correctly, you want to parent a pin to a layer.

 

Obviousvly the best workflow would be to add a null and copy/paste the pin position to that null. (delete all keyframes on null position). So they are on the same spot. Now you add this expression to the pin:

 

L = pickwhip null here

L.toWorld(L.anchorPoint);

 

And finally you parent the null to the layer you want.

 

The null will follow the picked layer, but with it's offset and the pin will follow the null's anchorpoint mapped in worldspace (which is the same space a pin lifes in). Since null and pin are on the same spot, there is no jump or offset.

 

 

Another workflow is:

 

Add your pin and the layer to follow. Add a keyframe to the layers position (another keyframe on the pin is already added).

Now you read out the position values on those keyframes. Since they are keyframed, those values won't change, aka this is the static offset you typed in all the time.

Finally you subtract the offset from the current position.

 

Code:

myPos = pickwhip pin there;

myPosStatic = myPos.key(1);

targetPos = pickwhip position of target layer here;

targetPosStatic = targetPos.key(1);

offset = targetPosStatic - myPosStatic ;

 

targetPos- offset;

 

*Martin

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Aug 11, 2020

Copy link to clipboard

Copied

Layers with Puppet Pin applied should not be scaled, moved, or rotated and you cannot animate any of those properties. The position of a puppet pin is based on the layer dimensions, not the comp space. A simple layer space transformation is not going to work. If no parenting is applied you just need to correct for layer positon. If you wanted a pin to follow null 1 the expression would look like this:

np = thisComp.layer("Null 1").transform.position;
layerP = position;
clp = ([width, height] / 2) - layerP;
clp + np

If the null is parented to something then you'll have to add in a layer space transformation, but this will fix position errors if the puppet pin layer has been moved. If the layer has been scaled then you will need to add in a factor for scale.

 

The best workflow is to just make sure that the layer with puppet pin applied does not have any position, scale, or rotation properties are at their default values. Just reset everything before you apply Puppet Pin and you won't have any problems.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...