I'm using Figma API to get a figma document but I can not get the rotation of a node. How is the rotation of an object calculated?
Asked
Active
Viewed 359 times
1 Answers
0
If you are using the Figma plugin API, you can just access rotation
property. See the documentation here.
If you are using the Figma REST API, you can get it from the relativeTransform
property. Given a transform value of [[m00, m01, m02], [m10, m11, m12]]
, I believe the rotation should be atan2(-m10, m00)
. This ends up being the angle of the x axis of the transform. Note that relativeTransform
is only present if you pass geometry=paths
. See the documentation here for more information.

constexpr
- 1,021
- 10
- 7