// Shared easing curves. Native gradient engines linearly interpolate between
// adjacent stops, so any non-linear profile has to be hand-stepped — this
// module owns the canonical samples so the same curve drives every place
// that needs perceptually-smooth fades (screen edge gradients, thread
// depth-stripe opacity, future call sites).
//
// `smoothstep(t) = 3t² − 2t³`: zero derivative at both endpoints. Avoids
// the bulbous mid-fade that a plain linear interpolation produces.

export function smoothstep(t: number): number {
  return 3 * t * t - 2 * t * t * t
}

// 7-stop smoothstep sample, t ∈ [0, 1]. Consumed as-is by gradient stops
// and as a lookup table for discrete fade tables.
export const SMOOTHSTEP_STOPS = [0, 1 / 6, 2 / 6, 3 / 6, 4 / 6, 5 / 6, 1] as const
export const SMOOTHSTEP_SAMPLES = SMOOTHSTEP_STOPS.map(smoothstep)
