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

createPath expression succeeded, but crashed with inTangents & outTangents

Explorer ,
Nov 15, 2023 Nov 15, 2023

Dear Community, I have studied everything I could find on this subject. 

 

This expression works as desired by connecting the points of a path with the corresponding number (16) of null objects by linking the position:

 

points = [

thisComp.layer("Null [1.1.00]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.01]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.02]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.03]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.04]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.05]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.06]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.07]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.08]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.09]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.10]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.11]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.12]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.13]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.14]").transform.position - [1000, 1000],
thisComp.layer("Null [1.1.15]").transform.position - [1000, 1000]]

createPath (points, inTangents = [], outTangents = [], isClosed = true)

 

Capture-1.JPG

 

For the life of me, I can't get a perfect circle. 🙂

TOPICS
Expressions , Scripting
560
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
Explorer ,
Nov 15, 2023 Nov 15, 2023

How do I adjust the above-mentioned expression using inTangents & outTangents?

 

This is what I mean by a perfect circle: 

 

Capture-2.JPG

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
Explorer ,
Nov 15, 2023 Nov 15, 2023

Solved!  I referenced the in & out tangents by another circle with the same number of points.

 

myPath = thisComp.layer("Effector | Path | Resizer").content("Ellipse 1").content("Path 1").path;

points = [
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.0]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.1]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.2]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.3]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.4]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.5]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.6]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.7]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.8]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.9]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.10]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.11]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.12]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.13]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.14]").transform.position - [1000, 1000],
thisComp.layer("Effector | Path | Resizer: Path 1 [1.1.15]").transform.position - [1000, 1000]]

inTangents = myPath.inTangents();
outTangents = myPath.outTangents();

createPath(points, inTangents, outTangents, isClosed = true)
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
Explorer ,
Nov 16, 2023 Nov 16, 2023

 I want to learn it and be able to have full control over the tangents via the createPath property like in Illustrator.

My solution does the job, but is faaaar beyond what you can call "control".

 

There are only a few tutorials that go into the details, but they skip the part with the tangents and fall back on alternative solutions, as in my case; such as generating additional points to create an illusion of roundness.

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 ,
Nov 17, 2023 Nov 17, 2023
LATEST

I don't know if this is going to help you at all, but it might give you some insight about the calculation for the tangents. As a demonstration, create a shape layer path by clicking in an empty comp window with the pen tool, then paste this in as the expression for the path:

n = 16;
r = 300;

p = [];
iT = [];
oT = [];
ratio = (4/3)*(Math.SQRT2 - 1)*(4/n);
t = r*ratio;
for (i = 0; i < n; i++){
  a = i*Math.PI*2/(n);
  x = r*Math.cos(a);
  y = r*Math.sin(a);
  p.push([x,y]);
  oTx = t*Math.cos(a + Math.PI/2);
  oTy = t*Math.sin(a + Math.PI/2);
  oT.push([oTx,oTy]);
  iT.push([-oTx,-oTy]);
}
createPath(p,iT,oT,true);

 

 

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