Skip to content

Commit

Permalink
fix: duration broken by #11
Browse files Browse the repository at this point in the history
  • Loading branch information
raae committed Dec 3, 2021
1 parent 3b1f222 commit 616a01f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ export const onInitialClientRender = (_, options) => {
return;
}

const now = Date.now();
const duration = 15 * 1000;
const animationEnd = now + duration;

const animationEnd = Date.now() + duration;
let skew = 1;

function randomInRange(min, max) {
return Math.random() * (max - min) + min;
}

const frame = () => {
const timeLeft = animationEnd - now;
const timeLeft = animationEnd - Date.now();
const ticks = Math.max(200, 500 * (timeLeft / duration));
skew = Math.max(0.8, skew - 0.001);

Expand Down

0 comments on commit 616a01f

Please sign in to comment.