• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I move CornerPins to the exact points when a layer moved into Z space to align it with comp?

Contributor ,
Feb 14, 2020 Feb 14, 2020

Copy link to clipboard

Copied

I want to calculate the distance between the 4-corner of CornerPin effect with respective composition corners to move them exact point instead of eyeballing it?

TOPICS
Expressions , How to , Resources , User interface or workspaces

Views

663

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
community guidelines

correct answers 1 Correct answer

Advisor , Feb 15, 2020 Feb 15, 2020

In that case it's even easier.
For the top left point just use the expression:

 

fromCompToSurface([0,0,0])

 

EDITED: for the other points, use:

Top right:

 

fromCompToSurface([thisComp.width,0,0])

 

Bottom left:

 

fromCompToSurface([0,thisComp.height,0])

 

Bottom right:

 

fromCompToSurface([thisComp.width,thisComp.height,0])

 

 

Votes

Translate

Translate
LEGEND ,
Feb 14, 2020 Feb 14, 2020

Copy link to clipboard

Copied

It's a cosine transform based on the distance and zoom level.

 

Mylenium

Votes

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
community guidelines
Contributor ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

Can you please show me an example. How can I make it work for a single corner?

Votes

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
community guidelines
Advisor ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

If I'm reading your post correctly - you want to match the corner pins of a layer in 3D space with the corners of another 2D layer? The best way to do this is with layer space transform expressions - but this is a complex area.

Lets's call your layer: "solid2D".  On your upper left corner property paste this expression:

 

S2D = thisComp.layer("solid2D"); //get the name of the layer.
S2DP = S2D.toComp([0,0,0]);      // get the layer's upper left position in Comp space.
fromCompToSurface(S2DP)          // project that Comp position onto the surface of the 3D layer.

 

You will need to adjust the layer name: "solid2d", to your own layer name.

That should give you a matching position for the upper left corner pin.

For the other corner pins replace the second line of the expression as follows:

for upper right:

 

S2DP = S2D.toComp([S2D.width,0,0]);

 

for lower left:

 

S2DP = S2D.toComp([0,S2D.height,0]);

 

lower right:

 

S2DP = S2D.toComp([S2D.width,S2D.height,0]);

 

 

I hope the above helps! 

Votes

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
community guidelines
Contributor ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

Thank you so much. It helped. But I don't want match the corners of 3D Layers to the corners of  2D layer. I need to match the corners of 3D layers with composition. By this method I had to create a guide 2D layer to get information of each corners.  Is there a way that you can directly feed composition corner information to this expression without using a 2D layer??? If there's no way other than this. Just let me know I can mark it as Correct Answer. Thank you again sir...

Votes

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
community guidelines
Advisor ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

In that case it's even easier.
For the top left point just use the expression:

 

fromCompToSurface([0,0,0])

 

EDITED: for the other points, use:

Top right:

 

fromCompToSurface([thisComp.width,0,0])

 

Bottom left:

 

fromCompToSurface([0,thisComp.height,0])

 

Bottom right:

 

fromCompToSurface([thisComp.width,thisComp.height,0])

 

 

Votes

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
community guidelines
Contributor ,
Feb 15, 2020 Feb 15, 2020

Copy link to clipboard

Copied

LATEST

Thank you so much.

Votes

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
community guidelines