I am trying to write an expression in After Effects, to display the degrees of rotation of an object. The problem is than, when the element is rotated counter clockwise, it doesn't start at 360
and than will count down to 0
. It will show me negative numbers from 0 to - negative infinite.
When rotate clockwise it will start from 0
and after it passed the 360
it will start over again from 0
.
How can I solve the counter clockwise rotation to the correct way?
x = Math.floor(thisComp.layer("Ellipse 2").transform.rotation)
if (x >= 0) x + "°"
if (x >= 360) x%360 + "°"
The code is applied to an text layer, that will display the correct degrees of the element "Ellipse 2".
You can use the following function to convert the value to positive to make sure you logic works