UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

10 lines (7 loc) 318 B
import { velocityPerSecond } from 'motion-utils'; const velocitySampleDuration = 5; // ms function calcGeneratorVelocity(resolveValue, t, current) { const prevT = Math.max(t - velocitySampleDuration, 0); return velocityPerSecond(current - resolveValue(prevT), t - prevT); } export { calcGeneratorVelocity };