# [Tutorial] Gravity Rotation

You will need 2 elements (exactly the same - just because currently Facer can only give us 2 different outcomes from conditions).

Here you have their rotation and transparency scripts (in that order):

1st element:

``````\$(accelerometerRawY())>3?(((((accelerometerRawY())*(accelerometerRawX()))/(((accelerometerRawY())*(accelerometerRawY()))+(0.28125*(accelerometerRawX())*(accelerometerRawX()))))/pi)*180):((((pi+((accelerometerRawY())*(accelerometerRawX()))/(((accelerometerRawY())*(accelerometerRawY()))+(0.28125*(accelerometerRawX())*(accelerometerRawX())))))/pi)*180)\$

\$((accelerometerRawY())/(accelerometerRawX()))>1||((accelerometerRawY())/(accelerometerRawX()))<-1&&(abs(accelerometerRawY()))>3?100:0\$
``````

2nd element

``````\$(accelerometerRawX())>3?((((pi/2)-(((accelerometerRawY())*(accelerometerRawX()))/(((accelerometerRawX())*(accelerometerRawX()))+(0.28125*(accelerometerRawY())*(accelerometerRawY())))))/pi)*180):((((pi/-2)-(((accelerometerRawY())*(accelerometerRawX()))/(((accelerometerRawX())*(accelerometerRawX()))+(0.28125*(accelerometerRawY())*(accelerometerRawY())))))/pi)*180)\$

\$((accelerometerRawY())/(accelerometerRawX()))>-1&&((accelerometerRawY())/(accelerometerRawX()))<1&&(abs(accelerometerRawX()))>3?100:0\$
``````

Explanation:

Why 2 elements?
It’s actually 4, I just used conditions to put 2 into 1.

Why 4 elements then?
When you think about a way of changing x and y position of watch’s accelerometers’ readings into an angle you normally would use arctangent of their ratio…
…but Facer don’t have an arctangent function in it, so I went digging and found this:

I used 4 mentioned ranges to create 4 scripts (while changing the outcome from radians to degrees).
Then I jammed them into only 2 elements (using conditions based on x and y accelerometers ratio) and voilà.

Here you have an example of a face that uses those scripts (elements named “roll”): Mellin - Attitude Indicator - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer

I hope this will help someone

3 Likes

Unlocking this, we are still working on organizing these posts.

So…
Do you want me to move it, or not?
I don’t get it.

you’re good! just keep it here.