slowed down the whole animation industry
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 1m30s

This commit is contained in:
2026-02-24 22:31:54 +00:00
parent 0c93c6bc27
commit b087172bb1
2 changed files with 22 additions and 12 deletions

View File

@@ -9,9 +9,10 @@ import { useTemplateRef, onMounted, onBeforeUnmount } from "vue";
const container = useTemplateRef("container");
const SPEED = 1; // px per frame
const SPEED = 0.0005; // % per frame
const PAUSE = 2000; // ms at top/bottom
let pos = 0;
let direction = 1; // 1 = down, -1 = up
let timeoutId;
let timeoutId2;
@@ -27,17 +28,27 @@ function handleHover() {
function tick() {
const el = container.value;
el.scrollTop += SPEED * direction;
const reachedBottom = el.scrollTop + el.clientHeight >= el.scrollHeight;
const reachedTop = el.scrollTop <= 0;
const reachedBottom = pos <= 0;
const reachedTop = pos >= 1;
console.log("speed");
if (reachedBottom || reachedTop) {
direction *= -1;
if (reachedBottom) {
pos = 0.001;
direction = 1;
handleHover();
return;
} else if (reachedTop) {
pos = 0.999;
direction = -1;
handleHover();
return;
}
pos += direction * SPEED;
el.scrollTop = pos * el.scrollHeight;
timeoutId = requestAnimationFrame(tick);
}