()
| 278 | const stopThreshold = 0.015 - 0.01 * d; |
| 279 | const maxFrames = Math.round(90 + 270 * d); |
| 280 | const step = () => { |
| 281 | vX *= frictionMul; |
| 282 | vY *= frictionMul; |
| 283 | if (Math.abs(vX) < stopThreshold && Math.abs(vY) < stopThreshold) { |
| 284 | inertiaRAF.current = null; |
| 285 | return; |
| 286 | } |
| 287 | if (++frames > maxFrames) { |
| 288 | inertiaRAF.current = null; |
| 289 | return; |
| 290 | } |
| 291 | const nextX = clamp(rotationRef.current.x - vY / 200, -maxVerticalRotationDeg, maxVerticalRotationDeg); |
| 292 | const nextY = wrapAngleSigned(rotationRef.current.y + vX / 200); |
| 293 | rotationRef.current = { x: nextX, y: nextY }; |
| 294 | applyTransform(nextX, nextY); |
| 295 | inertiaRAF.current = requestAnimationFrame(step); |
| 296 | }; |
| 297 | stopInertia(); |
| 298 | inertiaRAF.current = requestAnimationFrame(step); |
| 299 | }, |
nothing calls this directly
no test coverage detected