feat: add true gesture-driven full-viewport video feed and polished motion

This commit is contained in:
2026-10-08 16:09:57 +08:00
parent 693990d9fb
commit c0b752da3a
9 changed files with 449 additions and 53 deletions
+12
View File
@@ -0,0 +1,12 @@
/** Positive movement means pulling the previous page down; negative means pushing to the next. */
export function swipeDirection(distance: number, velocity: number, height: number): -1 | 0 | 1 {
if (height <= 0) return 0;
const committed = Math.abs(distance) > height * .19 || (Math.abs(velocity) > .4 && Math.abs(distance) > 20);
return committed ? (distance < 0 ? 1 : -1) : 0;
}
/** Three unique videos are kept mounted and repositioned around the active page. */
export function pagePosition(videoIndex: number, activeIndex: number): -1 | 0 | 1 {
const relative = (videoIndex - activeIndex + 3) % 3;
return relative === 2 ? -1 : relative as 0 | 1;
}