Copy link to clipboard
Copied
Is kind of an explanation of what I am trying to do.
I have 2 known points, a slope, the angle I want it to rotate to, and the hypotenuse.
I've spent at least an hour trying different things, and googling.
Any idea on what I should do? Currently just setting the width larger, and then using .rotation.
Thanks.
use a top center reg point. assign your circle's x,y to match the upper point's x,y. then assign the circle's width and height to be distance between the two points and finally its rotation to be the atan2 between the two points:
circle_mc.x = p1.x;
circle_mc.y = p1.y;
circle_mc.width = circle_mc.height = Math.sqrt((p2.y-p1.y)*(p2.y-p1.y)+(p2.x-p1.x)*(p2.x-p1.x));
circle_mc.rotation = -90+ 180*Math.atan2(p2.y-p1.y,p2.x-p1.x)/Math.PI;
Copy link to clipboard
Copied
use a top center reg point. assign your circle's x,y to match the upper point's x,y. then assign the circle's width and height to be distance between the two points and finally its rotation to be the atan2 between the two points:
circle_mc.x = p1.x;
circle_mc.y = p1.y;
circle_mc.width = circle_mc.height = Math.sqrt((p2.y-p1.y)*(p2.y-p1.y)+(p2.x-p1.x)*(p2.x-p1.x));
circle_mc.rotation = -90+ 180*Math.atan2(p2.y-p1.y,p2.x-p1.x)/Math.PI;
Copy link to clipboard
Copied
Thank You. That was exactly what I was looking for! Works exactly how I wanted it to.
One thing I removed the mc.width part, it was causing a large circle to be between the points. So I took that out and left it to default.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now