mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-15 13:14:35 +00:00
@@ -37,16 +37,6 @@ export const TextShimmer = <T extends ValidComponent = "span">(props: {
|
||||
clearTimeout(timer)
|
||||
})
|
||||
|
||||
const len = createMemo(() => Math.max(text().length, 1))
|
||||
const shimmerSize = createMemo(() => 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 s = shimmerSize() / 100
|
||||
return Math.max(1000, Math.min(2500, Math.round((len() * (s - 1)) / VELOCITY)))
|
||||
})
|
||||
|
||||
return (
|
||||
<Dynamic
|
||||
component={props.as ?? "span"}
|
||||
@@ -57,8 +47,6 @@ 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">
|
||||
|
||||
Reference in New Issue
Block a user