(pulse: Pulse, elapsedMs: number)
| 275 | * heraus, bei jedem `elapsed`: ein ruhiger Koerper aendert seine Groesse nicht. |
| 276 | */ |
| 277 | export function pulseScaleAt(pulse: Pulse, elapsedMs: number): number { |
| 278 | if (pulse.periodMs <= 0 || pulse.amplitude <= 0) { |
| 279 | return 1; |
| 280 | } |
| 281 | const phase = (elapsedMs % pulse.periodMs) / pulse.periodMs; |
| 282 | return 1 + pulse.amplitude * (0.5 - 0.5 * Math.cos(phase * Math.PI * 2)); |
| 283 | } |
| 284 | |
| 285 | /* ------------------------------------------------------------- die Welle --- */ |
| 286 |
no outgoing calls
no test coverage detected