feat(webui): animate log rows — entrance + scroll edge fade (#185)

Give the virtualized log viewer motion without hurting readability or choking at
high rate. A genuinely new tail line fades and rises in (200ms, ease-out-expo);
detection lives in the SSE flush (real arrivals only), is bounded by a 260ms
timer, and never replays when an old row scrolls back into view or when a filter
toggles. A firehose batch (more than 4 new lines in one flush) suppresses the
per-row entrance so a 100 line/s stream never strobes — the scroll flow and edge
fade carry it instead.

Scrolling gets a soft, scroll-position-aware edge fade: a boundary dissolves only
when there is actually hidden content past it (a ResizeObserver + scroll listener
keep it in sync), so a fully-scrolled top/bottom row is never dimmed. The entrance
animation lives on an inner element so it never collides with the virtual row's
own translateY positioning or perturbs measureElement. All of it is gated on the
motion switches: the entrance on reduce/disable-motion, the static edge fade on
the hard 关闭全部动效 only.
This commit is contained in:
DrSmoothl committed 2026-07-07 23:27:46 +08:00
1 parent b6fb5bd530
commit 90f65654c7
2 files changed
+136 -23

No files matched your search

+32
View File
@@ -237,6 +237,38 @@ html[data-kiosk="1"] [data-kiosk-hide] {
display: none !important;
}
/* Log stream row entrance — a subtle fade + rise for a genuinely new tail line.
transform+opacity only (composited, cheap at high rate); the virtual row's own
translateY positioning lives on the OUTER wrapper, so this INNER animation
never fights it or perturbs measureElement. Applied only to real arrivals and
auto-suppressed in bursts; gated in JS on reduce/disable-motion, and the rules
below also neutralise it. */
@keyframes log-row-in {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
.log-row-in {
animation: log-row-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
/* Soft edge fade for the log scroll viewport — rows dissolve at a boundary as
they scroll past it (Apple-style). Scroll-position-aware: each edge only fades
when there is actually hidden content in that direction, so a fully-scrolled
top/bottom row is never dimmed (readability). A static mask, not motion: kept
under reduce-motion, dropped only on the hard 关闭全部动效 switch. */
.log-fade-top {
-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 100%);
mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 100%);
}
.log-fade-bottom {
-webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 18px), transparent 100%);
mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 18px), transparent 100%);
}
.log-fade-both {
-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%);
}
/* Reduce motion: a CSS fallback for non-Framer transitions/animations.
Framer Motion itself is handled by <MotionConfig reducedMotion>. */
html[data-reduce-motion="1"] *,