import {Interpolation, InterpolatorArgs, InterpolatorFn, Arrify} from "@react-spring/web"; import {getAnimated} from "@react-spring/animated"; export class FixedInterpolation extends Interpolation { constructor(readonly source: unknown, args: InterpolatorArgs) { super(source, args); getAnimated(this)!.setValue(this._get()) } } export function altTo(source: unknown, args: InterpolatorArgs|InterpolatorFn, Output>): Interpolation { if (Array.isArray(args)) { return new FixedInterpolation(source, args) } else { return new FixedInterpolation(source, [args]) } }