Skip to content

Commit

Permalink
refactor gyro
Browse files Browse the repository at this point in the history
  • Loading branch information
lemehovskiy committed Dec 11, 2023
1 parent 932ec62 commit 77a44d8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ export default class ParallaxBackground {
const roundedGamma = Math.round(e.gamma || 0),
roundedBeta = Math.round(e.beta || 0);

let x = 0;
let y = 0;

if (roundedBeta > lastBeta && rangeBeta > 0) {
rangeBeta--;
} else if (roundedBeta < lastBeta && rangeBeta < maxRange) {
Expand All @@ -187,14 +184,10 @@ export default class ParallaxBackground {
const betaProgress = rangeBeta / maxRange;

if (this.deviceOrientation === DeviceOrientationTypes.Landscape) {
x = betaProgress;
y = gammaProgress;
this.animate(gammaProgress, betaProgress);
} else {
x = gammaProgress;
y = betaProgress;
this.animate(betaProgress, gammaProgress);
}

this.animate(y, x);
},
true,
);
Expand Down

0 comments on commit 77a44d8

Please sign in to comment.