Add angle rotation to glare

This commit is contained in:
Sergiu Sandor 2017-06-13 15:41:30 +03:00
parent 20a1d7fdf1
commit bf66b33229

View file

@ -113,12 +113,14 @@ export default class VanillaTilt {
let tiltX = (this.reverse * (this.settings.max / 2 - x * this.settings.max)).toFixed(2);
let tiltY = (this.reverse * (y * this.settings.max - this.settings.max / 2)).toFixed(2);
let angle = Math.atan2(this.event.clientX - (this.left + this.width / 2), -(this.event.clientY - (this.top + this.height / 2))) * (180 / Math.PI);
return {
tiltX: tiltX,
tiltY: tiltY,
percentageX: x * 100,
percentageY: y * 100
percentageY: y * 100,
angle: angle
};
}