Have you tried using this browser API https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope
It grants Javascript access to the gyroscope of the device, assuming there is one.
I am guessing you could write a little script that used those values to feed a number into the system action Set Layout Angle.
Haven't tried any of this myself, so it might not work, but I think it's worth a try.