The FXScript Reference

For Final Cut Pro created by Joe Maller

AngleTo

AngleTo(p1, p2)

Additional Notes

Angle between points

AngleTo returns the angle of a line connecting two points. This is the compliment to DistTo, measuring the angle of the triangle connecting two points.

360° values

AngleTo returns values from -180 through 180. When the second point is spatially above the first point, values are negative.

To achieve 360° values, add 180. That will place zero at 9:00 and increase clockwise.

To place zero at 3:00, add 360 then modulo by 360.
     (angleTo(box[1], box[2]) + 360) % 360

To match the FXScript Input controller with zero at top, rotating clockwise to 360°:
     (angleTo(box[1], box[2]) + 450) % 360