Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ui/src/components/text-shimmer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export const TextShimmer = <T extends ValidComponent = "span">(props: {
})

const shimmerSize = createMemo(() => {
const len = Math.max(props.text.length, 1)
const len = Math.max(props.text?.length ?? 0, 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 len = Math.max(props.text?.length ?? 0, 1)
const s = shimmerSize() / 100
return Math.max(1000, Math.min(2500, Math.round((len * (s - 1)) / VELOCITY)))
})
Expand Down
Loading