mirror of
https://github.com/micku7zu/vanilla-tilt.js
synced 2024-06-29 02:20:02 +02:00
Add angle rotation to glare
This commit is contained in:
parent
20a1d7fdf1
commit
bf66b33229
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue