mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 03:56:55 +03:00
refactor(tui): share clamp between tab pulse and fade-in text (#52996)
This commit is contained in:
committed by
GitHub
Unverified
parent
2a02be02a7
commit
fa373ddb51
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user