MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / step

Function step

src/tailwind/Components/DomeGallery/DomeGallery.jsx:280–296  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 },

Callers

nothing calls this directly

Calls 3

clampFunction · 0.70
wrapAngleSignedFunction · 0.70
applyTransformFunction · 0.70

Tested by

no test coverage detected