Copy link to clipboard
Copied
Can you create a circle with CreatePath()?
If not, is there another way to create a circle using expression?
Copy link to clipboard
Copied
Something like this should work:
r = 100; // radius
ratio = .5523;
t = r*ratio;
vertices = [[r,0],[0,r],[r,2*r],[2*r,r]];
inTangents = [[t,0],[0,-t],[-t,0],[0,t]];
outTangents = [[-t,0],[0,t],[t,0],[0,-t]];
closed = true;
createPath(vertices,inTangents,outTangents,closed);
Copy link to clipboard
Copied
This version might be better--it's centered at the anchor point:
r = 100; // radius
ratio = .5523;
t = r*ratio;
vertices = [[0,-r],[r,0],[0,r],[-r,0]];
inTangents = [[-t,0],[0,-t],[t,0],[0,t]];
outTangents = [[t,0],[0,t],[-t,0],[0,-t]];
closed = true;
createPath(vertices,inTangents,outTangents,closed);
Copy link to clipboard
Copied
This is great. I clearly didn't pay close attention in my maths classes. But why is the ratio .5523?
Plus it's super fun to link both radius and ratio to sliders and play around with them.
Copy link to clipboard
Copied
I think the actual formula is:
ratio = (Math.SQRT2 - 1)*(4/3);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now