@wardic/core 1.2.0 → 1.3.1
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/BaseValue.d.ts.map +1 -1
- package/dist/BaseValue.js +2 -0
- package/dist/BaseValue.js.map +1 -1
- package/dist/Batch.d.ts +6 -0
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +40 -10
- package/dist/Batch.js.map +1 -1
- package/dist/DefaultTransition.d.ts +21 -12
- package/dist/DefaultTransition.d.ts.map +1 -1
- package/dist/DefaultTransition.js +43 -2
- package/dist/DefaultTransition.js.map +1 -1
- package/dist/FrameLoop.d.ts +5 -1
- package/dist/FrameLoop.d.ts.map +1 -1
- package/dist/FrameLoop.js.map +1 -1
- package/dist/Machine.d.ts +3 -0
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +4 -3
- package/dist/Machine.js.map +1 -1
- package/dist/Spring.d.ts +7 -0
- package/dist/Spring.d.ts.map +1 -1
- package/dist/Spring.js +16 -0
- package/dist/Spring.js.map +1 -1
- package/dist/UnitScale.d.ts +39 -0
- package/dist/UnitScale.d.ts.map +1 -0
- package/dist/UnitScale.js +45 -0
- package/dist/UnitScale.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/frameLoop.js +5 -5
- package/dist/internal/frameLoop.js.map +1 -1
- package/dist/unstable/BatchCalls.d.ts +150 -0
- package/dist/unstable/BatchCalls.d.ts.map +1 -0
- package/dist/unstable/BatchCalls.js +319 -0
- package/dist/unstable/BatchCalls.js.map +1 -0
- package/dist/unstable/Config.d.ts +11 -0
- package/dist/unstable/Config.d.ts.map +1 -1
- package/dist/unstable/Config.js.map +1 -1
- package/dist/unstable/FrameEffects.d.ts +59 -0
- package/dist/unstable/FrameEffects.d.ts.map +1 -0
- package/dist/unstable/FrameEffects.js +142 -0
- package/dist/unstable/FrameEffects.js.map +1 -0
- package/dist/unstable/FrameTime.d.ts +1 -4
- package/dist/unstable/FrameTime.d.ts.map +1 -1
- package/dist/unstable/FrameTime.js +1 -4
- package/dist/unstable/FrameTime.js.map +1 -1
- package/dist/unstable/Imperative.d.ts +292 -0
- package/dist/unstable/Imperative.d.ts.map +1 -0
- package/dist/unstable/Imperative.js +922 -0
- package/dist/unstable/Imperative.js.map +1 -0
- package/dist/unstable/RetargetLegs.d.ts +2 -1
- package/dist/unstable/RetargetLegs.d.ts.map +1 -1
- package/dist/unstable/RetargetLegs.js +23 -15
- package/dist/unstable/RetargetLegs.js.map +1 -1
- package/dist/unstable/Spine.d.ts +17 -14
- package/dist/unstable/Spine.d.ts.map +1 -1
- package/dist/unstable/Spine.js +33 -16
- package/dist/unstable/Spine.js.map +1 -1
- package/package.json +1 -1
- package/src/BaseValue.ts +2 -0
- package/src/Batch.ts +62 -9
- package/src/DefaultTransition.ts +53 -2
- package/src/FrameLoop.ts +6 -2
- package/src/Machine.ts +7 -3
- package/src/Spring.ts +16 -0
- package/src/UnitScale.ts +56 -0
- package/src/index.ts +1 -0
- package/src/internal/frameLoop.ts +5 -5
- package/src/unstable/BatchCalls.ts +419 -0
- package/src/unstable/Config.ts +17 -0
- package/src/unstable/FrameEffects.ts +172 -0
- package/src/unstable/FrameTime.ts +1 -5
- package/src/unstable/Imperative.ts +1232 -0
- package/src/unstable/RetargetLegs.ts +20 -11
- package/src/unstable/Spine.ts +48 -21
|
@@ -39,6 +39,7 @@ import type * as InterpolatorRegistry from "../InterpolatorRegistry.ts"
|
|
|
39
39
|
import * as Machine from "../Machine.ts"
|
|
40
40
|
import * as ReducedMotion from "../ReducedMotion.ts"
|
|
41
41
|
import * as Spring from "../Spring.ts"
|
|
42
|
+
import * as UnitScale from "../UnitScale.ts"
|
|
42
43
|
import * as Values from "../Values.ts"
|
|
43
44
|
import type * as CoreMeasuredPairs from "./MeasuredPairs.ts"
|
|
44
45
|
import type * as Stops from "./Stops.ts"
|
|
@@ -622,17 +623,18 @@ export const legsOf = (
|
|
|
622
623
|
measured?: MeasuredPairs | undefined,
|
|
623
624
|
current?: Values.Values | undefined,
|
|
624
625
|
rests?: Values.Values | undefined,
|
|
626
|
+
unitScale: UnitScale.Rule = UnitScale.MOTIONS,
|
|
625
627
|
): ReadonlyArray<Leg> => {
|
|
626
628
|
// A Path (#438): `x` and `y` along it, on a leg of their own, and every other key as before.
|
|
627
629
|
const pathed = pathOf(from, to, given, reducedMotion, skipped, defaults, stops, current, rests)
|
|
628
630
|
if (Predicate.isNotUndefined(pathed)) {
|
|
629
|
-
return Arr.prepend(legsOf(from, pathed.rest, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured), pathed.leg)
|
|
631
|
+
return Arr.prepend(legsOf(from, pathed.rest, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured, undefined, undefined, unitScale), pathed.leg)
|
|
630
632
|
}
|
|
631
633
|
// Each key on its own transition (#301): with entries, the keys go by the transition each runs on.
|
|
632
634
|
const entries = entriesOf(given)
|
|
633
|
-
if (Predicate.isUndefined(entries)) return legsOn(from, to, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured)
|
|
635
|
+
if (Predicate.isUndefined(entries)) return legsOn(from, to, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured, unitScale)
|
|
634
636
|
// With no value's entry (`layout` and `default` alone), every key runs on one transition.
|
|
635
|
-
if (Bool.not(entries.byValue)) return legsOn(from, to, forKey(entries, "default"), reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured)
|
|
637
|
+
if (Bool.not(entries.byValue)) return legsOn(from, to, forKey(entries, "default"), reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured, unitScale)
|
|
636
638
|
const byTransition = new Map<Config.WardicTransition, Record<string, number | string>>()
|
|
637
639
|
Arr.forEach(Rec.keys(to), (key) => {
|
|
638
640
|
const runsOn = forKey(entries, key)
|
|
@@ -643,7 +645,7 @@ export const legsOf = (
|
|
|
643
645
|
}
|
|
644
646
|
byTransition.set(runsOn, { [key]: to[key] as number | string })
|
|
645
647
|
})
|
|
646
|
-
return Arr.flatMap(Arr.fromIterable(byTransition), ([runsOn, keys]) => legsOn(from, keys, runsOn, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured))
|
|
648
|
+
return Arr.flatMap(Arr.fromIterable(byTransition), ([runsOn, keys]) => legsOn(from, keys, runsOn, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured, unitScale))
|
|
647
649
|
}
|
|
648
650
|
|
|
649
651
|
/** No legs: a Retarget with no key. */
|
|
@@ -753,18 +755,20 @@ const legsOn = (
|
|
|
753
755
|
follow: Follows | undefined,
|
|
754
756
|
stops: StopsByKey | undefined,
|
|
755
757
|
measured: MeasuredPairs | undefined,
|
|
758
|
+
// ADR-0069 decision 8 (#883): the Environment's `UnitScale`, each key's units for its rest thresholds.
|
|
759
|
+
unitScale: UnitScale.Rule,
|
|
756
760
|
): ReadonlyArray<Leg> => {
|
|
757
761
|
const run = runOf(given)
|
|
758
762
|
if (Predicate.isNotUndefined(run)) {
|
|
759
|
-
if (run.type === "inertia") return inertiaLegsOn(from, to, run as Run & InertiaRun, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured)
|
|
760
|
-
return legsWith(from, to, run, reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured)
|
|
763
|
+
if (run.type === "inertia") return inertiaLegsOn(from, to, run as Run & InertiaRun, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured, unitScale)
|
|
764
|
+
return legsWith(from, to, run, reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured, unitScale)
|
|
761
765
|
}
|
|
762
766
|
const keys = Rec.keys(to)
|
|
763
767
|
if (keys.length === 0) return NO_LEGS
|
|
764
768
|
// Nearly always one Default transition for every key (a fade, a move): no grouping.
|
|
765
769
|
const first = defaultFor(defaults, UndefinedOr.getOrThrow(keys[0]), to, stops)
|
|
766
770
|
if (Arr.every(keys, (key) => defaultFor(defaults, key, to, stops) === first)) {
|
|
767
|
-
return legsWith(from, to, carried(first, given), reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured)
|
|
771
|
+
return legsWith(from, to, carried(first, given), reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured, unitScale)
|
|
768
772
|
}
|
|
769
773
|
const byDefault = new Map<DefaultTransition.Transition | DefaultTransition.KeyframesTransition, Record<string, number | string>>()
|
|
770
774
|
Arr.forEach(keys, (key) => {
|
|
@@ -776,7 +780,7 @@ const legsOn = (
|
|
|
776
780
|
}
|
|
777
781
|
byDefault.set(runsOn, { [key]: to[key] as number | string })
|
|
778
782
|
})
|
|
779
|
-
return Arr.flatMap(Arr.fromIterable(byDefault), ([runsOn, grouped]) => legsWith(from, grouped, carried(runsOn, given), reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured))
|
|
783
|
+
return Arr.flatMap(Arr.fromIterable(byDefault), ([runsOn, grouped]) => legsWith(from, grouped, carried(runsOn, given), reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured, unitScale))
|
|
780
784
|
}
|
|
781
785
|
|
|
782
786
|
/**
|
|
@@ -824,6 +828,8 @@ const legsWith = (
|
|
|
824
828
|
follow: Follows | undefined,
|
|
825
829
|
stops: StopsByKey | undefined,
|
|
826
830
|
measured: MeasuredPairs | undefined,
|
|
831
|
+
// ADR-0069 decision 8 (#883): the Environment's `UnitScale`, each key's units for its rest thresholds.
|
|
832
|
+
unitScale: UnitScale.Rule,
|
|
827
833
|
): ReadonlyArray<Leg> => {
|
|
828
834
|
// A **Skipped animation** (#468, Motion's `skipAnimations`): every key lands where its leg would end,
|
|
829
835
|
// on its first tick, with no delay and whatever reduced motion says. Keyframes land on their last
|
|
@@ -919,7 +925,8 @@ const legsWith = (
|
|
|
919
925
|
// Each key's own velocity, read now; none when the transition gives one, which every key then starts with.
|
|
920
926
|
let fromVelocity: Record<string, number> = NO_NUMBERS
|
|
921
927
|
if (Predicate.isUndefined(springOpts.velocity)) fromVelocity = Rec.map(numeric, (_, key) => velocities(key))
|
|
922
|
-
|
|
928
|
+
// Its keys' rest thresholds at the Environment's unit scale (ADR-0069 decision 8).
|
|
929
|
+
legs.push({ _tag: "Numbers", to: numeric, machine: () => Machine.springValues(numeric, springOpts, { from: fromNumeric, velocity: fromVelocity, records: "value", unitScale }) })
|
|
923
930
|
}
|
|
924
931
|
if (hasKeys(strings)) {
|
|
925
932
|
const fromStrings: Values.Values = Rec.map(strings, (_, key) => UndefinedOr.getOrThrow(from[key]))
|
|
@@ -984,6 +991,8 @@ const inertiaLegsOn = (
|
|
|
984
991
|
follow: Follows | undefined,
|
|
985
992
|
stops: StopsByKey | undefined,
|
|
986
993
|
measured: MeasuredPairs | undefined,
|
|
994
|
+
// ADR-0069 decision 8 (#883): the Environment's `UnitScale`, each key's units for its rest thresholds.
|
|
995
|
+
unitScale: UnitScale.Rule,
|
|
987
996
|
): ReadonlyArray<Leg> => {
|
|
988
997
|
let followingKeys = NO_KEYS
|
|
989
998
|
if (Predicate.isNotUndefined(follow)) followingKeys = follow.keysOf(to)
|
|
@@ -992,8 +1001,8 @@ const inertiaLegsOn = (
|
|
|
992
1001
|
const numbers = Rec.filter(to, glides)
|
|
993
1002
|
const rest = Rec.filter(to, (target, key) => Bool.not(glides(target, key)))
|
|
994
1003
|
const legs: Array<Leg> = []
|
|
995
|
-
if (hasKeys(numbers)) Arr.forEach(legsWith(from, numbers, run, reducedMotion, skipped, positionalKeys, velocities, undefined, stops, undefined), (leg) => legs.push(leg))
|
|
996
|
-
if (hasKeys(rest)) Arr.forEach(legsOn(from, rest, definingNone(given), reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured), (leg) => legs.push(leg))
|
|
1004
|
+
if (hasKeys(numbers)) Arr.forEach(legsWith(from, numbers, run, reducedMotion, skipped, positionalKeys, velocities, undefined, stops, undefined, unitScale), (leg) => legs.push(leg))
|
|
1005
|
+
if (hasKeys(rest)) Arr.forEach(legsOn(from, rest, definingNone(given), reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured, unitScale), (leg) => legs.push(leg))
|
|
997
1006
|
return legs
|
|
998
1007
|
}
|
|
999
1008
|
|
package/src/unstable/Spine.ts
CHANGED
|
@@ -26,6 +26,7 @@ import * as Machine from "../Machine.ts"
|
|
|
26
26
|
import * as Override from "../Override.ts"
|
|
27
27
|
import type * as ReducedMotion from "../ReducedMotion.ts"
|
|
28
28
|
import * as Supersede from "../Supersede.ts"
|
|
29
|
+
import * as UnitScale from "../UnitScale.ts"
|
|
29
30
|
import * as Values from "../Values.ts"
|
|
30
31
|
import * as Report from "./Report.ts"
|
|
31
32
|
import type * as MeasuredPairs from "./MeasuredPairs.ts"
|
|
@@ -523,10 +524,11 @@ export interface Running extends Machine.RunOptions {
|
|
|
523
524
|
frames: number
|
|
524
525
|
/** When it drew its last frame, on {@link FrameTime.frameNow}'s clock; -Infinity before its first (#464). */
|
|
525
526
|
lastAt: number
|
|
526
|
-
/** A Blend leg's last frame's values, and the ones before them (the Snapshot's, before its first)
|
|
527
|
+
/** A Blend leg's last frame's values, and the ones before them (the Snapshot's, before its first) (#464). */
|
|
527
528
|
last: Values.Values | undefined
|
|
528
529
|
before: Values.Values | undefined
|
|
529
|
-
|
|
530
|
+
/** The time, in ms, its last frame's step covered: its run's dt then, which a Blend's change is over (#865). */
|
|
531
|
+
lastStep: number
|
|
530
532
|
/**
|
|
531
533
|
* A Numbers leg's last Frame (#663): its keys' velocities are read from it when one is asked for, as
|
|
532
534
|
* a Blend leg's are from its frames, by index from a spring's. None before its first frame.
|
|
@@ -722,14 +724,14 @@ export const runningOf = (to: Values.Values, resolution: Resolution, landing: La
|
|
|
722
724
|
lastAt: Number.NEGATIVE_INFINITY,
|
|
723
725
|
last: undefined,
|
|
724
726
|
before: undefined,
|
|
725
|
-
|
|
727
|
+
lastStep: Number.NEGATIVE_INFINITY,
|
|
726
728
|
physics: undefined,
|
|
727
729
|
})
|
|
728
730
|
|
|
729
731
|
/**
|
|
730
|
-
* A Blend leg's velocity for `key` (#464, Motion's `getVelocity`): its last two frames' change over
|
|
731
|
-
*
|
|
732
|
-
* on its first frame (a `set`, a `duration: 0`).
|
|
732
|
+
* A Blend leg's velocity for `key` (#464, Motion's `getVelocity`): its last two frames' change over the
|
|
733
|
+
* time its last step covered (#865), at most `MAX_VELOCITY_DELTA`; none for a string, nor for a Snap, a
|
|
734
|
+
* leg that landed on its first frame (a `set`, a `duration: 0`).
|
|
733
735
|
*/
|
|
734
736
|
const blendVelocityOf = (running: Running, key: string): number => {
|
|
735
737
|
if (Bool.and(running.done, running.frames < 2)) return 0
|
|
@@ -742,7 +744,9 @@ const blendVelocityOf = (running: Running, key: string): number => {
|
|
|
742
744
|
const before = beforeValues[key]
|
|
743
745
|
if (Bool.not(Predicate.isNumber(last))) return 0
|
|
744
746
|
if (Bool.not(Predicate.isNumber(before))) return 0
|
|
745
|
-
|
|
747
|
+
// The step's own time (#865): two frames' stamps are when their ticks were delivered, and a tick
|
|
748
|
+
// delivered late stretches the gap but not the step.
|
|
749
|
+
const apart = Math.min(running.lastStep, FrameTime.MAX_VELOCITY_DELTA)
|
|
746
750
|
if (apart <= 0) return 0
|
|
747
751
|
return (((last as number) - (before as number)) * 1000) / apart
|
|
748
752
|
}
|
|
@@ -856,6 +860,7 @@ const splitLegsOf = (
|
|
|
856
860
|
measured: RetargetLegs.MeasuredPairs | undefined,
|
|
857
861
|
current: Values.Values,
|
|
858
862
|
rests: Values.Values | undefined,
|
|
863
|
+
unitScale: UnitScale.Rule,
|
|
859
864
|
): SplitLegs => {
|
|
860
865
|
let returnsAt = 0
|
|
861
866
|
if (listed) returnsAt = resolution.layers.length
|
|
@@ -867,7 +872,7 @@ const splitLegsOf = (
|
|
|
867
872
|
if (Rec.isEmptyRecord(picked)) return
|
|
868
873
|
let followed: RetargetLegs.Follows | undefined
|
|
869
874
|
if (i === returnsAt) followed = follow
|
|
870
|
-
const groupLegs = RetargetLegs.legsOf(from, picked, groupTransitionOf(resolution, groups, i, transition, element, extraDelay, reuse), reduce, skipped, positionalKeys, defaultTransition, velocities, followed, stops, measured, current, rests)
|
|
875
|
+
const groupLegs = RetargetLegs.legsOf(from, picked, groupTransitionOf(resolution, groups, i, transition, element, extraDelay, reuse), reduce, skipped, positionalKeys, defaultTransition, velocities, followed, stops, measured, current, rests, unitScale)
|
|
871
876
|
Arr.forEach(groupLegs, (built) => {
|
|
872
877
|
legs.push(built)
|
|
873
878
|
tags.push(i)
|
|
@@ -1966,15 +1971,21 @@ export interface FollowNow {
|
|
|
1966
1971
|
|
|
1967
1972
|
/** What an **Imperative animation** tells of its legs on one element (#433). */
|
|
1968
1973
|
export interface ImperativeHooks {
|
|
1969
|
-
/**
|
|
1970
|
-
|
|
1974
|
+
/**
|
|
1975
|
+
* Every leg it started on the element landed, told after the gate's flush of their last frames:
|
|
1976
|
+
* `landed` false when a key of it was taken by a later animation, which it then never lands (#951).
|
|
1977
|
+
*/
|
|
1978
|
+
readonly settled: (landed: boolean) => void
|
|
1971
1979
|
/** A leg failed, reported already (ADR-0030). */
|
|
1972
1980
|
readonly failed: (cause: Cause.Cause<unknown>) => void
|
|
1973
1981
|
}
|
|
1974
1982
|
|
|
1975
1983
|
/** An **Imperative animation** on one element (#433): its legs, built at the call, run through its Playhead. */
|
|
1976
1984
|
export interface ImperativeTrack {
|
|
1977
|
-
/**
|
|
1985
|
+
/**
|
|
1986
|
+
* Run every leg from the Playhead's time: those running end first, so a seek starts them again there,
|
|
1987
|
+
* and its keys are taken back from whatever draws them now.
|
|
1988
|
+
*/
|
|
1978
1989
|
readonly run: () => void
|
|
1979
1990
|
/** End every leg where it is: its keys stay there, the animation's. */
|
|
1980
1991
|
readonly stop: () => void
|
|
@@ -2022,6 +2033,8 @@ export interface SpineHost {
|
|
|
2022
2033
|
readonly element: Subject.Subject
|
|
2023
2034
|
readonly positionalKeys: ReducedMotion.PositionalKeys["Service"]
|
|
2024
2035
|
readonly defaultTransition: DefaultTransition.DefaultTransition["Service"]
|
|
2036
|
+
/** The Environment's unit scale, its legs' rest thresholds' for `x`, `y` and `z` (ADR-0069 decision 8). */
|
|
2037
|
+
readonly unitScale: UnitScale.Rule
|
|
2025
2038
|
/** Each key's velocity, as of the take. */
|
|
2026
2039
|
readonly readVelocity: RetargetLegs.Velocities
|
|
2027
2040
|
readonly gate: FlushGate.Shape
|
|
@@ -2084,8 +2097,24 @@ export interface ElementSpine {
|
|
|
2084
2097
|
* *Amendment (#200)*). A leg the token didn't reach is interrupted (`endLeg`). The runtime's own
|
|
2085
2098
|
* fiber Scope interrupts what's left when the provider ends.
|
|
2086
2099
|
*/
|
|
2100
|
+
/** Each runtime's unit scale, read once: a mount reads a WeakMap, not a run of its own. */
|
|
2101
|
+
// Module state (#460, Q7): held weakly by the runtime, so it goes with it.
|
|
2102
|
+
const UNIT_SCALES = new WeakMap<object, UnitScale.Rule>()
|
|
2103
|
+
|
|
2104
|
+
/** `runtime`'s Environment's `UnitScale`, read at its first ask. */
|
|
2105
|
+
export const unitScaleOf = (runtime: WardicServices.Runner<WardicServices.WardicServices>): UnitScale.Rule => {
|
|
2106
|
+
const known = UNIT_SCALES.get(runtime)
|
|
2107
|
+
if (Predicate.isNotUndefined(known)) return known
|
|
2108
|
+
const read = runtime.runSync(UnitScale.UnitScale)
|
|
2109
|
+
UNIT_SCALES.set(runtime, read)
|
|
2110
|
+
return read
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2087
2113
|
export const makeElementSpine = (options: ElementSpineOptions): ElementSpine => {
|
|
2088
2114
|
const { animation, byName, canStart, config, defaultTransition, diagnostics, element, extraDelay, gate, id, links, live, measuredPairs, onFrame, ownValues, parent, positionalKeys, presence, runtime, snapshot, start, styleNow, tag, variableValues } = options
|
|
2115
|
+
// The Environment's unit scale (ADR-0069 decision 8, #883): read from the runtime the spine already holds,
|
|
2116
|
+
// so no binding passes it; 1, Motion's own, unless the Environment's Layers give another.
|
|
2117
|
+
const unitScale = unitScaleOf(runtime)
|
|
2089
2118
|
const { initialLink, initialValues, startedLink } = start
|
|
2090
2119
|
const { linksFor, ownValue, startLinkOf } = links
|
|
2091
2120
|
let handoff = options.handoff
|
|
@@ -2405,17 +2434,14 @@ export const makeElementSpine = (options: ElementSpineOptions): ElementSpine =>
|
|
|
2405
2434
|
// A snap's or a blend's frames: merged into the Snapshot (ADR-0004), as the spring's are. A blend's
|
|
2406
2435
|
// last two are kept, its keys' velocities read from them (#464): the frame's own values, which a
|
|
2407
2436
|
// blend makes anew each frame (`values` writes one object for a leg that lost keys).
|
|
2408
|
-
const sink = (frame: Frame.Frame<Values.Values
|
|
2437
|
+
const sink = (frame: Frame.Frame<Values.Values>, dt: number): undefined => {
|
|
2409
2438
|
const value = running.values(frame.value)
|
|
2410
2439
|
let before = running.last
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
if (Predicate.isUndefined(before)) {
|
|
2414
|
-
before = snapshot.values
|
|
2415
|
-
beforeAt = snapshot.now() - FrameTime.NOMINAL_FRAME
|
|
2416
|
-
}
|
|
2440
|
+
// Its first frame: from the Snapshot's values.
|
|
2441
|
+
if (Predicate.isUndefined(before)) before = snapshot.values
|
|
2417
2442
|
running.before = before
|
|
2418
|
-
|
|
2443
|
+
// Over the time its step covered (#865), its first's included: its run's dt, in ms.
|
|
2444
|
+
running.lastStep = dt * 1000
|
|
2419
2445
|
running.last = frame.value
|
|
2420
2446
|
snapshot.values = { ...snapshot.values, ...value }
|
|
2421
2447
|
gate.write(id, value)
|
|
@@ -2548,6 +2574,7 @@ export const makeElementSpine = (options: ElementSpineOptions): ElementSpine =>
|
|
|
2548
2574
|
element,
|
|
2549
2575
|
positionalKeys,
|
|
2550
2576
|
defaultTransition,
|
|
2577
|
+
unitScale,
|
|
2551
2578
|
readVelocity,
|
|
2552
2579
|
gate,
|
|
2553
2580
|
forget,
|
|
@@ -2938,10 +2965,10 @@ export const makeElementSpine = (options: ElementSpineOptions): ElementSpine =>
|
|
|
2938
2965
|
if (Predicate.isUndefined(groups) && hasKeys(fresh)) {
|
|
2939
2966
|
// Where every key is now: a Path's axis the target leaves out starts there (#438), and ends where
|
|
2940
2967
|
// it rests (#574).
|
|
2941
|
-
retargetLegs = RetargetLegs.legsOf(from, fresh, transition, reduce, skipped, positionalKeys, defaultTransition, readVelocity, follow, manyStops, measured, snapshot.values, rests)
|
|
2968
|
+
retargetLegs = RetargetLegs.legsOf(from, fresh, transition, reduce, skipped, positionalKeys, defaultTransition, readVelocity, follow, manyStops, measured, snapshot.values, rests, unitScale)
|
|
2942
2969
|
}
|
|
2943
2970
|
if (Predicate.isNotUndefined(groups)) {
|
|
2944
|
-
const split = splitLegsOf(fresh, from, groups, resolution, listed, transition, elementTransition, extraDelay, options.reuse, reduce, skipped, positionalKeys, defaultTransition, readVelocity, follow, manyStops, measured, snapshot.values, rests)
|
|
2971
|
+
const split = splitLegsOf(fresh, from, groups, resolution, listed, transition, elementTransition, extraDelay, options.reuse, reduce, skipped, positionalKeys, defaultTransition, readVelocity, follow, manyStops, measured, snapshot.values, rests, unitScale)
|
|
2945
2972
|
retargetLegs = split.legs
|
|
2946
2973
|
legGroups = split.tags
|
|
2947
2974
|
}
|