Home
API: forms

Type Alias: Timed\<T\>

lifecycle-kit

lifecycle-kit


lifecycle-kit / forms / Timed

Type Alias: Timed<T>

Timed<T> = T | ((phase) => T)

Defined in: forms/path.ts:363

A parameter that may vary with time.

Either a constant, or a pure function of phase. This is how a jellyfish bell pulses without time leaking into Path.

Phase is in turns, not radians and not seconds. Turns because one full cycle is exactly 1.0, so the loop point is a value a test can name exactly instead of an approximate comparison against 2π. Not seconds because a duration is the consumer's decision: bioluminescent-sea drives its own pulsePhase at its own rate and the library has no business owning a clock.

Turns make the loop point exact at the seam, not inside a consumer's own arithmetic. Math.sin(2 * Math.PI) is -2.4e-16 rather than 0, so a rule that converts turns to radians and calls sin can still land a few ulps apart at phase 0 versus phase 1. That is a property of the trigonometry, not of this type, and the mitigation belongs where the periodicity is built: derive a cyclic parameter from phase % 1 so that phase 1 and phase 0 take the same path through the arithmetic. What turns buy is that such a rule CAN be exact, which a radian-based phase forecloses outright.

Type Parameters

T

T