News ticker: constant scroll speed

Derive the animation duration from the distance travelled instead of
the item count, so wide screens no longer scroll faster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-10-22 19:54:33 +00:00
1 parent 94b290fa06
commit 3c24ddc7d3
1 file changed
+8 -1
+8 -1
View File
@@ -2658,7 +2658,14 @@ function NewsTicker() {
<div className="ts-news-ticker">
<span className="ts-news-label">{t("news.label")}</span>
<div className="ts-news-track">
<div className="ts-news-scroll" style={{ animationDuration: `${Math.max(20, items.length * 12)}s` }}>
{/* Duration from the distance travelled (track + text), so the speed is
the same ~60 px/s on every screen width. */}
<div
className="ts-news-scroll"
ref={(el) => {
if (el) el.style.animationDuration = `${el.scrollWidth / 60}s`;
}}
>
{entries}
</div>
</div>