MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / springStep

Function springStep

graph-ui/src/agents/agent-motion.ts:388–402  ·  view source on GitHub ↗
(
    state: SpringState,
    goal: number,
    deltaSeconds: number,
    periodMs: number = FOLLOW_SPRING_PERIOD_MS,
)

Source from the content-addressed store, hash-verified

386 * der zurueckkommt) nicht einen ganzen Anflug in einem Sprung erledigt.
387 */
388export function springStep(
389 state: SpringState,
390 goal: number,
391 deltaSeconds: number,
392 periodMs: number = FOLLOW_SPRING_PERIOD_MS,
393): SpringState {
394 const dt = Math.min(0.1, Math.max(0, deltaSeconds));
395 if (dt === 0 || periodMs <= 0) {
396 return state;
397 }
398 const omega = (2 * Math.PI) / (periodMs / 1000);
399 const velocity = state.velocity
400 + (-2 * omega * state.velocity - omega * omega * (state.value - goal)) * dt;
401 return { value: state.value + velocity * dt, velocity };
402}

Callers 2

CameraAnimatorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected