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

Can't use thisComp in a path on parented text. How can I overcome this?

Participant ,
Feb 11, 2024 Feb 11, 2024

I want to rotate three words around a null object. Easy. Parent the words to the null and hit one rotation property. Then, apply this "value - parent.transform.rotation" on each word's rotation to keep them upright.

 

I then wanted to make it look better by having lines between the words. The points of each line are references using thisComp to point to the words as shown below:

 

p1 = thisComp.layer("Word1").position;
p2 = thisComp.layer("Word2").position;
pts = [p1, p2];
createPath(pts, inTangents = [], outTangents = [], isClosed = false)

 

This does not work because the expression can't use thisComp to connect the lines. This is because the line points then go to 0,0, which is what the anchoring values become when parented to the null. Now I need a better configuration or expressions to make it work with just a null, three words and three lines. I am trying to create a fluid triangle shape based on the layer's position but only needing one rotation property to the keyframe instead of keyframing each word's positions and making non-uniform triangles.

 

 

 

TOPICS
Expressions , How to
732
Translate
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

Community Expert , Feb 11, 2024 Feb 11, 2024

You're probably looking for something like this:

L1 =thisComp.layer("Simplifi");
L2 = thisComp.layer("RFiD");
p1 = fromComp(L1.toComp(L1.anchorPoint));
p2 = fromComp(L2.toComp(L2.anchorPoint));
p =[p1,p2];
createPath(p,[],[],false)
Translate
LEGEND ,
Feb 11, 2024 Feb 11, 2024

Convert the coordinates using toWorld() or whatever other layer space transform method is appropriate.

 

Mylenium

Translate
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
Participant ,
Feb 11, 2024 Feb 11, 2024

Could you please explain how this would work with an example? I need to learn this. I wouldn't know what layers space transform method is appropriate.  It's very much in a minimalist phase

Johannes282932510fis_0-1707668498230.png

 

Translate
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
Community Expert ,
Feb 11, 2024 Feb 11, 2024

You're probably looking for something like this:

L1 =thisComp.layer("Simplifi");
L2 = thisComp.layer("RFiD");
p1 = fromComp(L1.toComp(L1.anchorPoint));
p2 = fromComp(L2.toComp(L2.anchorPoint));
p =[p1,p2];
createPath(p,[],[],false)
Translate
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
Participant ,
Feb 12, 2024 Feb 12, 2024
LATEST

Thank you, this worked. That is precisely what I needed for this project.

Translate
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
Advocate ,
Feb 11, 2024 Feb 11, 2024

You can parent the Shape Layer to the Null and set the position to [0,0]

 

Text Layers Position:

radius = 400;
x = Math.cos(degreesToRadians(120) * (index - 1)) * radius;
y = Math.sin(degreesToRadians(120) * (index - 1)) * radius;
[x,y]

 

Text Layers Rotation:

value - parent.rotation

 

Shape Layer Path:

p1 = thisComp.layer("Word 1").position;
p2 = thisComp.layer("Word 2").position;
p3 = thisComp.layer("Word 3").position;
pts = [p1, p2, p3];
createPath(pts, inTangents = [], outTangents = [], isClosed = true)

 

screenshot.png

 

Translate
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
Participant ,
Feb 12, 2024 Feb 12, 2024

Thank you, this looks interesting. I definitely need to use a lot more math equations like this. It seems to have a lot more functionality than boring entry-level basics.

Translate
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