10 lines
318 B
Plaintext
10 lines
318 B
Plaintext
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 };
|