UNPKG

@redocly/theme

Version:

Shared UI components lib

15 lines (13 loc) 527 B
/** * Enhanced smoothstep function for smooth interpolation with configurable threshold. * Used in active heading detection to create virtual positions for better scroll behavior. */ export function enhancedSmoothstep(input: number, threshold: number = 0.4): number { if (input <= threshold) { return 0; } const normalizedValue = Math.min(Math.max((input - threshold) / (1 - threshold), 0), 1); return ( 3 * normalizedValue * normalizedValue - 2 * normalizedValue * normalizedValue * normalizedValue ); }