All files / web/src/components/toys/shared animationMath.ts

100% Statements 4/4
100% Branches 1/1
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 51x 1x 10x 10x  
/** Damped sinusoidal oscillation — used for spring snap-back and shake effects */
export function decayingSin(t: number, freq: number, decay: number): number {
  return Math.sin(t * freq * Math.PI * 2) * Math.exp(-t * decay)
}