import { Easing, interpolate } from "remotion"; /** Small motion helpers shared by all illustrations. All of them are pure functions of the frame. */ const CLAMP = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const; /** 0 before `from`, 1 after `to`, linear in between. */ export const progress = (frame: number, from: number, to: number): number => interpolate(frame, [from, to], [0, 1], CLAMP); export const mix = (from: number, to: number, t: number): number => from + (to - from) * t; export const inOut = Easing.inOut(Easing.cubic); export const out = Easing.out(Easing.cubic); /** Overshoots slightly, for things that pop in. */ export const pop = Easing.out(Easing.back(2.2)); /** `pop` between two frames: 0 before, 1 after. */ export const popAt = (frame: number, from: number, length = 8): number => pop(progress(frame, from, from + length));