refactor(tui): share clamp between tab pulse and fade-in text (#52996)

This commit is contained in:
Kit Langton
2026-10-03 21:33:28 -07:00
committed by GitHub
Unverified
parent 2a02be02a7
commit fa373ddb51
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -3,7 +3,7 @@ import { extend, type JSX } from "@opentui/solid"
import { splitProps } from "solid-js"
import { useConfig } from "../config"
import { MaskedTextRenderable } from "./masked-text"
import { coast, smootherstep } from "./tab-pulse"
import { clamp, coast, smootherstep } from "./tab-pulse"
type FadeInTextOptions = TextOptions & {
backdrop?: RGBA
@@ -14,7 +14,6 @@ type FadeInTextOptions = TextOptions & {
const DURATION = 200
const FEATHER = 8
const clamp = (value: number) => Math.max(0, Math.min(1, value))
class FadeInTextRenderable extends MaskedTextRenderable {
private _backdrop = RGBA.defaultBackground()
+1 -1
View File
@@ -29,7 +29,7 @@ type TabPulseOptions = RenderableOptions<TabPulseRenderable> & {
onLevel?: (level: number) => void
}
const clamp = (value: number) => Math.max(0, Math.min(1, value))
export const clamp = (value: number) => Math.max(0, Math.min(1, value))
export const smootherstep = (value: number) => value * value * value * (value * (value * 6 - 15) + 10)
const RUN_DURATION = 2_800
const RUN_ATTACK = 450