okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
743a6b3c6
main
1/** Numbers that move: the pure parts of a short count-up / count-down between two readings. */ 2export const easeOutCubic = ( t :number ) => 1 - Math . pow ( 1 - Math . min ( 1 , Math . max ( 0 , t )), 3 ); 3 4/** The value between `from` and `to` after `elapsed` of `duration` milliseconds. */ 5export function tweenValue ( from :number , to :number , elapsed :number , duration :number ) :number { 6if ( ! Number . isFinite ( from ) || ! Number . isFinite ( to ) || duration <= 0 ) return to ; 7return from + ( to - from ) * easeOutCubic ( elapsed / duration ); 8}