I want to show a cup of water in my web page.I want when the user rotate their device, the water should go down to the horizon line as natural.
window.addEventListener('deviceorientation', this.handleOrientation.bind(this));
handleOrientation(orientData) {
var absolute = orientData.absolute;
var alpha = orientData.alpha;
var beta = orientData.beta;
var gamma = orientData.gamma;
}
From the api above , I can get those four angle information. But I don't know how to get the current angle from the device to the horizon line so that I could set my water to rotate to the horizon line.