Skip to content

Commit

Permalink
chore(style): format code
Browse files Browse the repository at this point in the history
  • Loading branch information
rektdeckard committed Jul 26, 2024
1 parent 5d804ec commit 01ed44a
Show file tree
Hide file tree
Showing 23 changed files with 4,680 additions and 2,386 deletions.
5,408 changes: 3,451 additions & 1,957 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ export function App() {
</section>
</main>
</>
)
);
}

1 change: 0 additions & 1 deletion src/components/countdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
height: 100%;
opacity: min(90%, calc((var(--scroll) - 12%) * 11));
}

41 changes: 25 additions & 16 deletions src/components/countdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class Timer {
} else {
this.stop();
}
}, 1000)
}, 1000);
}

stop() {
clearInterval(this.interval)
clearInterval(this.interval);
this.interval = undefined;
}

Expand All @@ -48,18 +48,25 @@ export function Countdown() {
const [remaining] = timer.signal;

createEffect(() => {
window.addEventListener("scroll", (_e) => {
document.documentElement.style.setProperty(
"--scroll",
`${window.scrollY / (document.body.offsetHeight - window.innerHeight) * 100}%`,
);
}, false);

const observer = new IntersectionObserver(([entry]) => {
if (entry.isIntersecting) {
timer.start();
}
}, { threshold: 0.4 });
window.addEventListener(
"scroll",
(_e) => {
document.documentElement.style.setProperty(
"--scroll",
`${(window.scrollY / (document.body.offsetHeight - window.innerHeight)) * 100}%`,
);
},
false,
);

const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
timer.start();
}
},
{ threshold: 0.4 },
);
observer.observe(countRef);
});

Expand Down Expand Up @@ -131,7 +138,7 @@ void main() {
gl_FragColor = vec4(vec3(rnd),1.0) + vec4(vec3(pattern),0.1) / 4.0;
}
`)
`);
});

function reset() {
Expand All @@ -142,7 +149,9 @@ void main() {
return (
<div id="countdown" ref={containerRef!} onClick={reset}>
<div class="overlay"></div>
<span id="count" ref={countRef!}>{remaining()}</span>
<span id="count" ref={countRef!}>
{remaining()}
</span>
<canvas ref={canvasRef!} />
</div>
);
Expand Down
Loading

0 comments on commit 01ed44a

Please sign in to comment.