@glissade/core 0.54.0-pre.0 → 0.55.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +22 -1
- package/dist/index.js +39 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -470,6 +470,27 @@ type Rng = () => number;
|
|
|
470
470
|
/** Returns a deterministic [0,1) generator for the given integer seed. */
|
|
471
471
|
declare function random(seed: number): Rng;
|
|
472
472
|
//#endregion
|
|
473
|
+
//#region src/noise.d.ts
|
|
474
|
+
/**
|
|
475
|
+
* `valueNoise(seed, t)` — closed-form smooth value noise, a PURE function of
|
|
476
|
+
* `(seed, t)`. It lerps between two lattice hash values with a smoothstep ease of
|
|
477
|
+
* the fractional part:
|
|
478
|
+
*
|
|
479
|
+
* valueNoise(seed, t) = lerp(rand(seed, ⌊t⌋), rand(seed, ⌊t⌋+1), smoothstep(fract t))
|
|
480
|
+
*
|
|
481
|
+
* There is NO stored state, NO `bake()`, NO `Date.now`/`Math.random` — the only
|
|
482
|
+
* randomness is the seeded splitmix hash (`random`, DESIGN.md §5.5), so it is
|
|
483
|
+
* deterministic BY CONSTRUCTION: byte-identical run-to-run and re-entrant under
|
|
484
|
+
* out-of-order `evaluate()` (the determinism contract). fps-independent, O(1), and
|
|
485
|
+
* freely seekable — the closed-form sibling of a spring.
|
|
486
|
+
*
|
|
487
|
+
* Range is [0, 1) (the same as `rand`); center it to a signed jitter with
|
|
488
|
+
* `valueNoise(seed, t) * 2 - 1`. Reused by the `shake` driver + camera whole-frame
|
|
489
|
+
* shake (`@glissade/scene/motion`) and available to any scene that wants a smooth
|
|
490
|
+
* deterministic wobble (`window.glissade.valueNoise`).
|
|
491
|
+
*/
|
|
492
|
+
declare function valueNoise(seed: number, t: number): number;
|
|
493
|
+
//#endregion
|
|
473
494
|
//#region src/bake.d.ts
|
|
474
495
|
interface BakeConfig<W> {
|
|
475
496
|
/** seconds of simulation; keys land on the frame grid */
|
|
@@ -505,4 +526,4 @@ interface CheckpointedSim {
|
|
|
505
526
|
}
|
|
506
527
|
declare function bakeCheckpointed<W, S = W>(cfg: CheckpointedBakeConfig<W, S>): CheckpointedSim;
|
|
507
528
|
//#endregion
|
|
508
|
-
export { type AssetRef, type AudioClip, type BakeConfig, BakeError, type BindOptions, type BindTarget, BindTypeMismatchError, type BindableSignal, type BoundTimeline, type CheckpointedBakeConfig, type CheckpointedSim, type ChildEntry, CircularDependencyError, ColorParseError, type ColorStop, type CompiledTimeline, type CoverageReport, type CurveSampler, DEFAULT_EASE, type DevWarning, type EaseSpec, type EasingFn, type Equals, type FontAxes, type FontFaceRef, type FontMode, type FontRegistry, type FontUsage, FontValidationError, type GainEnvelope, type GradientInterpolation, type HandoffKind, type Json, type Key, type KeyOpts, type Marker, type MeshInterpolation, type MeshPaint, type MeshPoint, type MissingGlyphs, type OkLab, type Paint, type PathContour, type PathValue, type Playhead, type Position, PositionError, type ReadonlySignal, type ResolvedFace, type RetargetSpring, type Rgba, type Rng, type Scheduler, type Signal, type SignalOptions, type SpringConfig, type SpringEase, type StaggerOpts, type StaggerSpec, TARGET_PATH, type TargetCarrier, type Timeline, type TimelineBuilder, type TimelineInit, TimelineValidationError, type Track, TrackValidationError, type TweenOpts, type TweenTarget, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, type ValidateFontsOptions, type ValueType, type ValueTypeId, ValueTypeInferenceError, type Vec2, type Vec2Component, type Vec2Signal, WriteDuringEvaluationError, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, endReadPhase, evaluateAt, fontAxesType, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, listValueTypes, namedEasing, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
|
529
|
+
export { type AssetRef, type AudioClip, type BakeConfig, BakeError, type BindOptions, type BindTarget, BindTypeMismatchError, type BindableSignal, type BoundTimeline, type CheckpointedBakeConfig, type CheckpointedSim, type ChildEntry, CircularDependencyError, ColorParseError, type ColorStop, type CompiledTimeline, type CoverageReport, type CurveSampler, DEFAULT_EASE, type DevWarning, type EaseSpec, type EasingFn, type Equals, type FontAxes, type FontFaceRef, type FontMode, type FontRegistry, type FontUsage, FontValidationError, type GainEnvelope, type GradientInterpolation, type HandoffKind, type Json, type Key, type KeyOpts, type Marker, type MeshInterpolation, type MeshPaint, type MeshPoint, type MissingGlyphs, type OkLab, type Paint, type PathContour, type PathValue, type Playhead, type Position, PositionError, type ReadonlySignal, type ResolvedFace, type RetargetSpring, type Rgba, type Rng, type Scheduler, type Signal, type SignalOptions, type SpringConfig, type SpringEase, type StaggerOpts, type StaggerSpec, TARGET_PATH, type TargetCarrier, type Timeline, type TimelineBuilder, type TimelineInit, TimelineValidationError, type Track, TrackValidationError, type TweenOpts, type TweenTarget, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, type ValidateFontsOptions, type ValueType, type ValueTypeId, ValueTypeInferenceError, type Vec2, type Vec2Component, type Vec2Signal, WriteDuringEvaluationError, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, endReadPhase, evaluateAt, fontAxesType, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, listValueTypes, namedEasing, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, valueNoise, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
package/dist/index.js
CHANGED
|
@@ -1004,6 +1004,44 @@ function evaluateAt(playhead, t, read) {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
//#endregion
|
|
1007
|
+
//#region src/noise.ts
|
|
1008
|
+
/**
|
|
1009
|
+
* `valueNoise(seed, t)` — closed-form smooth value noise, a PURE function of
|
|
1010
|
+
* `(seed, t)`. It lerps between two lattice hash values with a smoothstep ease of
|
|
1011
|
+
* the fractional part:
|
|
1012
|
+
*
|
|
1013
|
+
* valueNoise(seed, t) = lerp(rand(seed, ⌊t⌋), rand(seed, ⌊t⌋+1), smoothstep(fract t))
|
|
1014
|
+
*
|
|
1015
|
+
* There is NO stored state, NO `bake()`, NO `Date.now`/`Math.random` — the only
|
|
1016
|
+
* randomness is the seeded splitmix hash (`random`, DESIGN.md §5.5), so it is
|
|
1017
|
+
* deterministic BY CONSTRUCTION: byte-identical run-to-run and re-entrant under
|
|
1018
|
+
* out-of-order `evaluate()` (the determinism contract). fps-independent, O(1), and
|
|
1019
|
+
* freely seekable — the closed-form sibling of a spring.
|
|
1020
|
+
*
|
|
1021
|
+
* Range is [0, 1) (the same as `rand`); center it to a signed jitter with
|
|
1022
|
+
* `valueNoise(seed, t) * 2 - 1`. Reused by the `shake` driver + camera whole-frame
|
|
1023
|
+
* shake (`@glissade/scene/motion`) and available to any scene that wants a smooth
|
|
1024
|
+
* deterministic wobble (`window.glissade.valueNoise`).
|
|
1025
|
+
*/
|
|
1026
|
+
/** smoothstep on a value already in [0,1] (the fractional part) — 3t²−2t³. */
|
|
1027
|
+
function smoothstep01(t) {
|
|
1028
|
+
return t * t * (3 - 2 * t);
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Deterministic hash of the integer lattice point `i` for `seed` → [0, 1). Folds
|
|
1032
|
+
* `seed` and `i` into one uint32 (a splitmix-friendly mix) then draws one splitmix
|
|
1033
|
+
* step from core's seeded `random` — so adjacent seeds/lattice points decorrelate.
|
|
1034
|
+
*/
|
|
1035
|
+
function latticeRand(seed, i) {
|
|
1036
|
+
return random((Math.imul(i | 0, 2654435761) ^ (seed | 0)) >>> 0)();
|
|
1037
|
+
}
|
|
1038
|
+
function valueNoise(seed, t) {
|
|
1039
|
+
const i = Math.floor(t);
|
|
1040
|
+
const f = t - i;
|
|
1041
|
+
const a = latticeRand(seed, i);
|
|
1042
|
+
return a + (latticeRand(seed, i + 1) - a) * smoothstep01(f);
|
|
1043
|
+
}
|
|
1044
|
+
//#endregion
|
|
1007
1045
|
//#region src/bake.ts
|
|
1008
1046
|
/**
|
|
1009
1047
|
* bake() (DESIGN.md §2.8): stateful simulation as a compilation step. Run the
|
|
@@ -1108,4 +1146,4 @@ function bakeCheckpointed(cfg) {
|
|
|
1108
1146
|
};
|
|
1109
1147
|
}
|
|
1110
1148
|
//#endregion
|
|
1111
|
-
export { BakeError, BindTypeMismatchError, CircularDependencyError, ColorParseError, DEFAULT_EASE, FontValidationError, PositionError, TARGET_PATH, TimelineValidationError, TrackValidationError, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, ValueTypeInferenceError, WriteDuringEvaluationError, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, endReadPhase, evaluateAt, fontAxesType, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, listValueTypes, namedEasing, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
|
1149
|
+
export { BakeError, BindTypeMismatchError, CircularDependencyError, ColorParseError, DEFAULT_EASE, FontValidationError, PositionError, TARGET_PATH, TimelineValidationError, TrackValidationError, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, ValueTypeInferenceError, WriteDuringEvaluationError, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, endReadPhase, evaluateAt, fontAxesType, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, listValueTypes, namedEasing, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, valueNoise, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.55.0-pre.0",
|
|
4
4
|
"description": "glissade core: signals, tracks, timeline document, evaluation, easing, springs, seeded RNG. Zero DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|