STUPID SEXY TIMELINE (#16420)

This commit is contained in:
Kit Langton
2026-03-07 06:25:22 -05:00
committed by GitHub
parent b7e208b4f1
commit bbd0f3a252
44 changed files with 5186 additions and 2080 deletions

View File

@@ -36,6 +36,19 @@ export const TextShimmer = <T extends ValidComponent = "span">(props: {
clearTimeout(timer)
})
const shimmerSize = createMemo(() => {
const len = Math.max(props.text.length, 1)
return Math.max(300, Math.round(200 + 1400 / len))
})
// duration = len × (size - 1) / velocity → uniform perceived sweep speed
const VELOCITY = 0.01375 // ch per ms, ~10% faster than original 0.0125 baseline
const shimmerDuration = createMemo(() => {
const len = Math.max(props.text.length, 1)
const s = shimmerSize() / 100
return Math.max(1000, Math.min(2500, Math.round((len * (s - 1)) / VELOCITY)))
})
return (
<Dynamic
component={props.as ?? "span"}
@@ -46,6 +59,8 @@ export const TextShimmer = <T extends ValidComponent = "span">(props: {
style={{
"--text-shimmer-swap": `${swap}ms`,
"--text-shimmer-index": `${offset()}`,
"--text-shimmer-size": `${shimmerSize()}%`,
"--text-shimmer-duration": `${shimmerDuration()}ms`,
}}
>
<span data-slot="text-shimmer-char">