@glissade/core 0.4.1 → 0.4.3
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 +18 -3
- package/dist/index.js +13 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,14 @@ declare class TrackValidationError extends Error {
|
|
|
265
265
|
declare function validateTrack(track: Track): void;
|
|
266
266
|
type KeyOpts<T> = Partial<Omit<Key<T>, 't' | 'value'>>;
|
|
267
267
|
declare function key<T>(t: number, value: T, easeOrOpts?: EaseSpec | KeyOpts<T>): Key<T>;
|
|
268
|
+
/**
|
|
269
|
+
* The settle-ON-the-beat helper: a spring key must sit at prev.t +
|
|
270
|
+
* spring.duration(cfg) (§2.7), so beat-anchored authoring otherwise means
|
|
271
|
+
* hand-computing the launch time. springTo returns the [launch, settle] key
|
|
272
|
+
* pair with the arithmetic done — spread it into a raw track():
|
|
273
|
+
* track('x/width', 'number', [...springTo(beats.start('drop'), 0, 320, cfg)])
|
|
274
|
+
*/
|
|
275
|
+
declare function springTo<T>(endT: number, from: T, to: T, cfg: SpringConfig): [Key<T>, Key<T>];
|
|
268
276
|
declare function track<T>(target: string, type: ValueTypeId, keys: Key<T>[], opts?: {
|
|
269
277
|
editable?: boolean;
|
|
270
278
|
}): Track<T>;
|
|
@@ -305,6 +313,14 @@ interface AssetRef {
|
|
|
305
313
|
kind: 'font' | 'image' | 'audio' | 'video' | 'timeline';
|
|
306
314
|
url: string;
|
|
307
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* A gain envelope: keys of linear gain multipliers on the clip's local time
|
|
318
|
+
* axis. A full Track satisfies it structurally, but its target/type carry no
|
|
319
|
+
* meaning here — `{ keys: [...] }` is all a clip needs.
|
|
320
|
+
*/
|
|
321
|
+
interface GainEnvelope {
|
|
322
|
+
keys: Key[];
|
|
323
|
+
}
|
|
308
324
|
/** Audio is timeline metadata, never a render product (§5.3). */
|
|
309
325
|
interface AudioClip {
|
|
310
326
|
asset: AssetRef;
|
|
@@ -315,8 +331,7 @@ interface AudioClip {
|
|
|
315
331
|
start: number;
|
|
316
332
|
end: number;
|
|
317
333
|
};
|
|
318
|
-
|
|
319
|
-
gain?: Track;
|
|
334
|
+
gain?: GainEnvelope;
|
|
320
335
|
playbackRate?: number;
|
|
321
336
|
}
|
|
322
337
|
interface ChildEntry {
|
|
@@ -539,4 +554,4 @@ declare function normalizeEditedKeys(keys: Key[]): Key[];
|
|
|
539
554
|
*/
|
|
540
555
|
declare function mergeSidecar(code: Timeline, sidecar: SidecarDoc | null | undefined): Timeline;
|
|
541
556
|
//#endregion
|
|
542
|
-
export { type AssetRef, type AudioClip, type BakeConfig, BakeError, type BindTarget, type BindableSignal, type BoundTimeline, type CheckpointedBakeConfig, type CheckpointedSim, type ChildEntry, CircularDependencyError, ColorParseError, type CompiledTimeline, type CurveSampler, DEFAULT_EASE, type DevWarning, type EaseSpec, type EasingFn, type Equals, type HandoffKind, type Json, type Key, type KeyOpts, type Marker, type OkLab, type PathContour, type PathValue, type Playhead, type Position, PositionError, type ReadonlySignal, type RetargetSpring, type Rgba, type Rng, type SidecarDoc, SidecarVersionError, type Signal, type SignalOptions, type SpringConfig, type SpringEase, TARGET_PATH, type TargetCarrier, type Timeline, type TimelineBuilder, type TimelineInit, TimelineValidationError, type Track, TrackValidationError, type TweenOpts, type TweenTarget, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, type ValueType, type ValueTypeId, ValueTypeInferenceError, type Vec2, type Vec2Signal, WriteDuringEvaluationError, bake, bakeCheckpointed, beginReadPhase, bindTimeline, booleanType, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, key, lerpColor, mergeSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, parseColor, pathType, random, registerValueType, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, signal, spring, springEasing, springEasingDerivative, stringType, timeline, track, untracked, validateTrack, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
|
557
|
+
export { type AssetRef, type AudioClip, type BakeConfig, BakeError, type BindTarget, type BindableSignal, type BoundTimeline, type CheckpointedBakeConfig, type CheckpointedSim, type ChildEntry, CircularDependencyError, ColorParseError, type CompiledTimeline, type CurveSampler, DEFAULT_EASE, type DevWarning, type EaseSpec, type EasingFn, type Equals, type GainEnvelope, type HandoffKind, type Json, type Key, type KeyOpts, type Marker, type OkLab, type PathContour, type PathValue, type Playhead, type Position, PositionError, type ReadonlySignal, type RetargetSpring, type Rgba, type Rng, type SidecarDoc, SidecarVersionError, type Signal, type SignalOptions, type SpringConfig, type SpringEase, TARGET_PATH, type TargetCarrier, type Timeline, type TimelineBuilder, type TimelineInit, TimelineValidationError, type Track, TrackValidationError, type TweenOpts, type TweenTarget, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, type ValueType, type ValueTypeId, ValueTypeInferenceError, type Vec2, type Vec2Signal, WriteDuringEvaluationError, bake, bakeCheckpointed, beginReadPhase, bindTimeline, booleanType, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, key, lerpColor, mergeSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, parseColor, pathType, random, registerValueType, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, signal, spring, springEasing, springEasingDerivative, springTo, stringType, timeline, track, untracked, validateTrack, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
package/dist/index.js
CHANGED
|
@@ -864,6 +864,18 @@ function key(t, value, easeOrOpts) {
|
|
|
864
864
|
if (opts.derived !== void 0) k.derived = opts.derived;
|
|
865
865
|
return k;
|
|
866
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* The settle-ON-the-beat helper: a spring key must sit at prev.t +
|
|
869
|
+
* spring.duration(cfg) (§2.7), so beat-anchored authoring otherwise means
|
|
870
|
+
* hand-computing the launch time. springTo returns the [launch, settle] key
|
|
871
|
+
* pair with the arithmetic done — spread it into a raw track():
|
|
872
|
+
* track('x/width', 'number', [...springTo(beats.start('drop'), 0, 320, cfg)])
|
|
873
|
+
*/
|
|
874
|
+
function springTo(endT, from, to, cfg) {
|
|
875
|
+
const d = spring.duration(cfg);
|
|
876
|
+
if (endT - d < 0) throw new TrackValidationError("springTo", `this spring needs ${d.toFixed(3)}s to settle — endT must be ≥ its duration (got ${endT})`);
|
|
877
|
+
return [key(endT - d, from), key(endT, to, spring(cfg))];
|
|
878
|
+
}
|
|
867
879
|
function track(target, type, keys, opts) {
|
|
868
880
|
const tr = {
|
|
869
881
|
target,
|
|
@@ -1609,4 +1621,4 @@ function mergeSidecar(code, sidecar) {
|
|
|
1609
1621
|
return merged;
|
|
1610
1622
|
}
|
|
1611
1623
|
//#endregion
|
|
1612
|
-
export { BakeError, CircularDependencyError, ColorParseError, DEFAULT_EASE, PositionError, SidecarVersionError, TARGET_PATH, TimelineValidationError, TrackValidationError, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, ValueTypeInferenceError, WriteDuringEvaluationError, bake, bakeCheckpointed, beginReadPhase, bindTimeline, booleanType, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, key, lerpColor, mergeSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, parseColor, pathType, random, registerValueType, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, signal, spring, springEasing, springEasingDerivative, stringType, timeline, track, untracked, validateTrack, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
|
1624
|
+
export { BakeError, CircularDependencyError, ColorParseError, DEFAULT_EASE, PositionError, SidecarVersionError, TARGET_PATH, TimelineValidationError, TrackValidationError, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, ValueTypeInferenceError, WriteDuringEvaluationError, bake, bakeCheckpointed, beginReadPhase, bindTimeline, booleanType, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, inReadPhase, inferValueType, key, lerpColor, mergeSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, parseColor, pathType, random, registerValueType, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, signal, spring, springEasing, springEasingDerivative, springTo, stringType, timeline, track, untracked, validateTrack, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
package/package.json
CHANGED