@rafaelaugusto/jolt 0.1.0-rc.4 → 0.1.0-rc.5
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/README.md +4 -2
- package/dist/color.d.ts +2 -4
- package/dist/color.d.ts.map +1 -1
- package/dist/color.js +1 -41
- package/dist/color.js.map +1 -1
- package/dist/core/color.d.ts +5 -0
- package/dist/core/color.d.ts.map +1 -0
- package/dist/core/color.js +42 -0
- package/dist/core/color.js.map +1 -0
- package/dist/core/decay.d.ts +12 -0
- package/dist/core/decay.d.ts.map +1 -0
- package/dist/core/decay.js +29 -0
- package/dist/core/decay.js.map +1 -0
- package/dist/core/decoration.d.ts +5 -0
- package/dist/core/decoration.d.ts.map +1 -0
- package/dist/core/decoration.js +22 -0
- package/dist/core/decoration.js.map +1 -0
- package/dist/core/drag-physics.d.ts +25 -0
- package/dist/core/drag-physics.d.ts.map +1 -0
- package/dist/core/drag-physics.js +75 -0
- package/dist/core/drag-physics.js.map +1 -0
- package/dist/core/driver.d.ts +41 -0
- package/dist/core/driver.d.ts.map +1 -0
- package/dist/core/driver.js +2 -0
- package/dist/core/driver.js.map +1 -0
- package/dist/core/easing.d.ts +10 -0
- package/dist/core/easing.d.ts.map +1 -0
- package/dist/core/easing.js +88 -0
- package/dist/core/easing.js.map +1 -0
- package/dist/core/gravity.d.ts +13 -0
- package/dist/core/gravity.d.ts.map +1 -0
- package/dist/core/gravity.js +84 -0
- package/dist/core/gravity.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/ownership.d.ts +7 -0
- package/dist/core/ownership.d.ts.map +1 -0
- package/dist/core/ownership.js +23 -0
- package/dist/core/ownership.js.map +1 -0
- package/dist/core/playback.d.ts +44 -0
- package/dist/core/playback.d.ts.map +1 -0
- package/dist/core/playback.js +35 -0
- package/dist/core/playback.js.map +1 -0
- package/dist/core/presets.d.ts +298 -0
- package/dist/core/presets.d.ts.map +1 -0
- package/dist/core/presets.js +127 -0
- package/dist/core/presets.js.map +1 -0
- package/dist/core/properties.d.ts +8 -0
- package/dist/core/properties.d.ts.map +1 -0
- package/dist/core/properties.js +33 -0
- package/dist/core/properties.js.map +1 -0
- package/dist/core/sampling.d.ts +35 -0
- package/dist/core/sampling.d.ts.map +1 -0
- package/dist/core/sampling.js +123 -0
- package/dist/core/sampling.js.map +1 -0
- package/dist/core/spring.d.ts +24 -0
- package/dist/core/spring.d.ts.map +1 -0
- package/dist/core/spring.js +65 -0
- package/dist/core/spring.js.map +1 -0
- package/dist/core/track.d.ts +38 -0
- package/dist/core/track.d.ts.map +1 -0
- package/dist/core/track.js +476 -0
- package/dist/core/track.js.map +1 -0
- package/dist/core/transition.d.ts +116 -0
- package/dist/core/transition.d.ts.map +1 -0
- package/dist/core/transition.js +211 -0
- package/dist/core/transition.js.map +1 -0
- package/dist/decay.d.ts +1 -11
- package/dist/decay.d.ts.map +1 -1
- package/dist/decay.js +1 -28
- package/dist/decay.js.map +1 -1
- package/dist/decoration.d.ts +2 -5
- package/dist/decoration.d.ts.map +1 -1
- package/dist/decoration.js +2 -21
- package/dist/decoration.js.map +1 -1
- package/dist/drag-physics.d.ts +1 -24
- package/dist/drag-physics.d.ts.map +1 -1
- package/dist/drag-physics.js +1 -74
- package/dist/drag-physics.js.map +1 -1
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +9 -0
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/index.d.ts +3 -38
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/easing.d.ts +1 -9
- package/dist/easing.d.ts.map +1 -1
- package/dist/easing.js +1 -87
- package/dist/easing.js.map +1 -1
- package/dist/engine.d.ts +2 -11
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +9 -16
- package/dist/engine.js.map +1 -1
- package/dist/gravity.d.ts +1 -12
- package/dist/gravity.d.ts.map +1 -1
- package/dist/gravity.js +1 -83
- package/dist/gravity.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mixer.d.ts.map +1 -1
- package/dist/mixer.js +3 -1
- package/dist/mixer.js.map +1 -1
- package/dist/motion-scope.d.ts +2 -1
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +79 -32
- package/dist/motion-scope.js.map +1 -1
- package/dist/playback.d.ts +2 -34
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +1 -34
- package/dist/playback.js.map +1 -1
- package/dist/presets.d.ts +2 -297
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +2 -125
- package/dist/presets.js.map +1 -1
- package/dist/properties.d.ts +2 -6
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +3 -33
- package/dist/properties.js.map +1 -1
- package/dist/sampling.d.ts +1 -34
- package/dist/sampling.d.ts.map +1 -1
- package/dist/sampling.js +1 -122
- package/dist/sampling.js.map +1 -1
- package/dist/scroll-header/geometry.d.ts +1 -0
- package/dist/scroll-header/geometry.d.ts.map +1 -1
- package/dist/scroll-header/geometry.js +5 -0
- package/dist/scroll-header/geometry.js.map +1 -1
- package/dist/scroll-header/index.d.ts +14 -0
- package/dist/scroll-header/index.d.ts.map +1 -1
- package/dist/scroll-header/index.js +113 -8
- package/dist/scroll-header/index.js.map +1 -1
- package/dist/scroll-header/native.d.ts +8 -1
- package/dist/scroll-header/native.d.ts.map +1 -1
- package/dist/scroll-header/native.js +11 -4
- package/dist/scroll-header/native.js.map +1 -1
- package/dist/scroll-header/surface.d.ts +6 -0
- package/dist/scroll-header/surface.d.ts.map +1 -0
- package/dist/scroll-header/surface.js +12 -0
- package/dist/scroll-header/surface.js.map +1 -0
- package/dist/shared-navigation/index.d.ts.map +1 -1
- package/dist/shared-navigation/index.js +6 -1
- package/dist/shared-navigation/index.js.map +1 -1
- package/dist/shared-navigation/return-target.d.ts +2 -0
- package/dist/shared-navigation/return-target.d.ts.map +1 -1
- package/dist/shared-navigation/return-target.js +59 -9
- package/dist/shared-navigation/return-target.js.map +1 -1
- package/dist/spring.d.ts +1 -23
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +1 -64
- package/dist/spring.js.map +1 -1
- package/dist/track.d.ts +5 -31
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +9 -470
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +1 -115
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +1 -210
- package/dist/transition.js.map +1 -1
- package/dist/web/compose.d.ts +21 -0
- package/dist/web/compose.d.ts.map +1 -0
- package/dist/web/compose.js +128 -0
- package/dist/web/compose.js.map +1 -0
- package/dist/web/curve.d.ts +9 -0
- package/dist/web/curve.d.ts.map +1 -0
- package/dist/web/curve.js +42 -0
- package/dist/web/curve.js.map +1 -0
- package/dist/web/index.d.ts +3 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +3 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/plan.d.ts +11 -0
- package/dist/web/plan.d.ts.map +1 -0
- package/dist/web/plan.js +147 -0
- package/dist/web/plan.js.map +1 -0
- package/dist/web/press.d.ts +25 -0
- package/dist/web/press.d.ts.map +1 -0
- package/dist/web/press.js +174 -0
- package/dist/web/press.js.map +1 -0
- package/dist/web/public.d.ts +24 -0
- package/dist/web/public.d.ts.map +1 -0
- package/dist/web/public.js +18 -0
- package/dist/web/public.js.map +1 -0
- package/dist/web/runtime.d.ts +126 -0
- package/dist/web/runtime.d.ts.map +1 -0
- package/dist/web/runtime.js +767 -0
- package/dist/web/runtime.js.map +1 -0
- package/dist/web/types.d.ts +37 -0
- package/dist/web/types.d.ts.map +1 -0
- package/dist/web/types.js +12 -0
- package/dist/web/types.js.map +1 -0
- package/dist/web/vue/index.d.ts +27 -0
- package/dist/web/vue/index.d.ts.map +1 -0
- package/dist/web/vue/index.js +130 -0
- package/dist/web/vue/index.js.map +1 -0
- package/package.json +42 -7
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +137 -11
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeaderSurface.java +39 -0
- package/platforms/ios/src/JoltScrollHeader.h +2 -1
- package/platforms/ios/src/JoltScrollHeader.m +138 -12
- package/src/android-plugin.d.ts +5 -0
- package/src/color.ts +2 -56
- package/src/core/color.ts +55 -0
- package/src/core/decay.ts +54 -0
- package/src/core/decoration.ts +32 -0
- package/src/core/drag-physics.ts +110 -0
- package/src/core/driver.ts +53 -0
- package/src/core/easing.ts +120 -0
- package/src/core/gravity.ts +107 -0
- package/src/core/index.ts +24 -0
- package/src/core/ownership.ts +21 -0
- package/src/core/playback.ts +82 -0
- package/src/core/presets.ts +139 -0
- package/src/core/properties.ts +40 -0
- package/src/core/sampling.ts +173 -0
- package/src/core/spring.ts +113 -0
- package/src/core/track.ts +664 -0
- package/src/core/transition.ts +367 -0
- package/src/decay.ts +1 -54
- package/src/decoration.ts +7 -33
- package/src/drag-physics.ts +1 -110
- package/src/driver/android.ts +10 -0
- package/src/driver/index.ts +3 -50
- package/src/easing.ts +1 -120
- package/src/engine.ts +12 -24
- package/src/gravity.ts +1 -107
- package/src/index.ts +2 -0
- package/src/ios-plugin.d.ts +3 -1
- package/src/mixer.ts +3 -1
- package/src/motion-scope.ts +70 -29
- package/src/playback.ts +9 -73
- package/src/presets.ts +2 -128
- package/src/properties.ts +4 -45
- package/src/sampling.ts +1 -173
- package/src/scroll-header/geometry.ts +7 -0
- package/src/scroll-header/index.ts +134 -7
- package/src/scroll-header/native.ts +23 -3
- package/src/scroll-header/surface.ts +11 -0
- package/src/shared-navigation/index.ts +6 -0
- package/src/shared-navigation/return-target.ts +66 -12
- package/src/spring.ts +1 -113
- package/src/track.ts +12 -642
- package/src/transition.ts +1 -367
- package/src/web/compose.ts +172 -0
- package/src/web/curve.ts +50 -0
- package/src/web/index.ts +17 -0
- package/src/web/plan.ts +194 -0
- package/src/web/press.ts +217 -0
- package/src/web/public.ts +74 -0
- package/src/web/runtime.ts +923 -0
- package/src/web/types.ts +45 -0
- package/src/web/vue/index.ts +150 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export const DEFAULT_ACCELERATION = 1800;
|
|
2
|
+
export const DEFAULT_RESTITUTION = 0.55;
|
|
3
|
+
const MAX_FLIGHTS = 512;
|
|
4
|
+
const MAX_DURATION = 60_000;
|
|
5
|
+
/** Ballistic flights against one fixed boundary; no numerical integration or frame loop. */
|
|
6
|
+
export function solveGravity(from, to, acceleration, restitution, velocity, precision) {
|
|
7
|
+
if (![from, to, acceleration, restitution, velocity, precision].every(Number.isFinite) ||
|
|
8
|
+
acceleration <= 0 ||
|
|
9
|
+
restitution < 0 ||
|
|
10
|
+
restitution >= 1 ||
|
|
11
|
+
precision <= 0)
|
|
12
|
+
throw new RangeError('Invalid gravity position, acceleration, restitution or velocity.');
|
|
13
|
+
const direction = to < from ? -1 : 1;
|
|
14
|
+
const distance = Math.abs(to - from);
|
|
15
|
+
let speed = velocity * direction;
|
|
16
|
+
const impact = Math.hypot(speed, Math.sqrt(2 * acceleration * distance));
|
|
17
|
+
if (!Number.isFinite(impact))
|
|
18
|
+
throw new RangeError('Gravity motion exceeds the finite numeric range.');
|
|
19
|
+
// This form avoids cancellation when moving quickly toward a nearby boundary.
|
|
20
|
+
let seconds = speed >= 0
|
|
21
|
+
? distance === 0
|
|
22
|
+
? 0
|
|
23
|
+
: (2 * distance) / (impact + speed)
|
|
24
|
+
: (impact - speed) / acceleration;
|
|
25
|
+
let duration = 0;
|
|
26
|
+
const flights = [];
|
|
27
|
+
const breakpoints = [];
|
|
28
|
+
const addFlight = (origin, initial, length) => {
|
|
29
|
+
const end = duration + length * 1000;
|
|
30
|
+
if (!Number.isFinite(end) || end > MAX_DURATION || flights.length >= MAX_FLIGHTS)
|
|
31
|
+
throw new RangeError('Gravity motion must settle within 60 seconds and 512 flights.');
|
|
32
|
+
if (length > 0) {
|
|
33
|
+
const apex = duration - (initial / acceleration) * 1000;
|
|
34
|
+
if (apex > duration && apex < end)
|
|
35
|
+
breakpoints.push(apex);
|
|
36
|
+
flights.push({ start: duration, end, origin, speed: initial });
|
|
37
|
+
breakpoints.push(end);
|
|
38
|
+
duration = end;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
addFlight(-distance, speed, seconds);
|
|
42
|
+
speed = impact * restitution;
|
|
43
|
+
while (speed > precision * 10 || (speed * speed) / (2 * acceleration) > precision) {
|
|
44
|
+
seconds = (2 * speed) / acceleration;
|
|
45
|
+
addFlight(0, -speed, seconds);
|
|
46
|
+
speed *= restitution;
|
|
47
|
+
}
|
|
48
|
+
const flightAt = (time) => {
|
|
49
|
+
let lo = 0, hi = flights.length - 1;
|
|
50
|
+
while (lo < hi) {
|
|
51
|
+
const mid = (lo + hi) >>> 1;
|
|
52
|
+
if (time >= flights[mid].end)
|
|
53
|
+
lo = mid + 1;
|
|
54
|
+
else
|
|
55
|
+
hi = mid;
|
|
56
|
+
}
|
|
57
|
+
return flights[lo];
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
duration,
|
|
61
|
+
breakpoints,
|
|
62
|
+
position(time) {
|
|
63
|
+
if (time >= duration)
|
|
64
|
+
return to;
|
|
65
|
+
if (time <= 0)
|
|
66
|
+
return from;
|
|
67
|
+
const flight = flightAt(time);
|
|
68
|
+
const t = (time - flight.start) / 1000;
|
|
69
|
+
return (to +
|
|
70
|
+
direction *
|
|
71
|
+
Math.min(0, flight.origin + flight.speed * t + (acceleration * t * t) / 2));
|
|
72
|
+
},
|
|
73
|
+
velocity(time) {
|
|
74
|
+
if (duration === 0 || time >= duration)
|
|
75
|
+
return 0;
|
|
76
|
+
const flight = flightAt(Math.max(0, time));
|
|
77
|
+
return (direction *
|
|
78
|
+
(flight.speed + (acceleration * (Math.max(0, time) - flight.start)) / 1000));
|
|
79
|
+
},
|
|
80
|
+
// Valid between mandatory impact seams. Each flight is an exact quadratic.
|
|
81
|
+
interpolationError: (start, end) => (acceleration * ((end - start) / 1000) ** 2) / 8,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=gravity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gravity.js","sourceRoot":"","sources":["../../src/core/gravity.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAA;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AACvC,MAAM,WAAW,GAAG,GAAG,CAAA;AACvB,MAAM,YAAY,GAAG,MAAM,CAAA;AAE3B,4FAA4F;AAC5F,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,EAAU,EACV,YAAoB,EACpB,WAAmB,EACnB,QAAgB,EAChB,SAAiB;IAEjB,IACE,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClF,YAAY,IAAI,CAAC;QACjB,WAAW,GAAG,CAAC;QACf,WAAW,IAAI,CAAC;QAChB,SAAS,IAAI,CAAC;QAEd,MAAM,IAAI,UAAU,CAClB,kEAAkE,CACnE,CAAA;IAEH,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAA;IACpC,IAAI,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAA;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAA;IACxE,IAAI,CAAC,MAAM,CAAC,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AC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAC7E,CAAA;QACH,CAAC;QACD,QAAQ,CAAC,IAAI;YACX,IAAI,QAAQ,KAAK,CAAC,IAAI,IAAI,IAAI,QAAQ;gBAAE,OAAO,CAAC,CAAA;YAChD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;YAC1C,OAAO,CACL,SAAS;gBACT,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAC5E,CAAA;QACH,CAAC;QACD,2EAA2E;QAC3E,kBAAkB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;KACrF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createTrack, type Track, type CompilationSettings } from './track.js';
|
|
2
|
+
export { resolveTransition, mergeTransitions, fitTransition, origamiSpring, springs, type Transition, type ResolvedTransition, type Curve, } from './transition.js';
|
|
3
|
+
export { createClock, validateProgress, type Animation, type PlaybackAnimation, type PlaybackClock, type PlaybackCommand, type PlaybackState, } from './playback.js';
|
|
4
|
+
export { createOwnership } from './ownership.js';
|
|
5
|
+
export type { Driver, LayoutFrame } from './driver.js';
|
|
6
|
+
export type { Property, NumericProperty } from './properties.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,OAAO,EACP,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,KAAK,GACX,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACtD,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Internal portable boundary. This is not a published package entry point yet.
|
|
2
|
+
export { createTrack } from './track.js';
|
|
3
|
+
export { resolveTransition, mergeTransitions, fitTransition, origamiSpring, springs, } from './transition.js';
|
|
4
|
+
export { createClock, validateProgress, } from './playback.js';
|
|
5
|
+
export { createOwnership } from './ownership.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAwC,MAAM,YAAY,CAAA;AAC9E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,OAAO,GAIR,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,gBAAgB,GAMjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A registry per runtime/context. Tokens prevent old cleanup from changing a newer owner. */
|
|
2
|
+
export declare function createOwnership<Target extends object, Property extends string>(): {
|
|
3
|
+
get(target: Target, property: Property): symbol | undefined;
|
|
4
|
+
claim(target: Target, property: Property): symbol;
|
|
5
|
+
invalidate(target: Target, properties?: readonly Property[]): void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=ownership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../src/core/ownership.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM;gBAG9D,MAAM,YAAY,QAAQ;kBAGxB,MAAM,YAAY,QAAQ;uBAOrB,MAAM,eAAe,SAAS,QAAQ,EAAE;EAM9D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A registry per runtime/context. Tokens prevent old cleanup from changing a newer owner. */
|
|
2
|
+
export function createOwnership() {
|
|
3
|
+
const revisions = new WeakMap();
|
|
4
|
+
return {
|
|
5
|
+
get(target, property) {
|
|
6
|
+
return revisions.get(target)?.get(property);
|
|
7
|
+
},
|
|
8
|
+
claim(target, property) {
|
|
9
|
+
let tokens = revisions.get(target);
|
|
10
|
+
if (!tokens)
|
|
11
|
+
revisions.set(target, (tokens = new Map()));
|
|
12
|
+
const token = Symbol(property);
|
|
13
|
+
tokens.set(property, token);
|
|
14
|
+
return token;
|
|
15
|
+
},
|
|
16
|
+
invalidate(target, properties) {
|
|
17
|
+
const tokens = revisions.get(target);
|
|
18
|
+
for (const property of properties ?? tokens?.keys() ?? [])
|
|
19
|
+
tokens?.set(property, Symbol(property));
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.js","sourceRoot":"","sources":["../../src/core/ownership.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,eAAe;IAC7B,MAAM,SAAS,GAAG,IAAI,OAAO,EAAiC,CAAA;IAC9D,OAAO;QACL,GAAG,CAAC,MAAc,EAAE,QAAkB;YACpC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;QAC7C,CAAC;QACD,KAAK,CAAC,MAAc,EAAE,QAAkB;YACtC,IAAI,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YAClC,IAAI,CAAC,MAAM;gBAAE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAA;YACxD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;YAC9B,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;YAC3B,OAAO,KAAK,CAAA;QACd,CAAC;QACD,UAAU,CAAC,MAAc,EAAE,UAAgC;YACzD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YACpC,KAAK,MAAM,QAAQ,IAAI,UAAU,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;gBACvD,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;QAC3C,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface Animation extends PromiseLike<boolean> {
|
|
2
|
+
/**
|
|
3
|
+
* Resolves with `true` once the animation played to the end, or with `false`
|
|
4
|
+
* if it was stopped, superseded or skipped.
|
|
5
|
+
* Playback cancellation never rejects; sequences can reject setup/callback errors.
|
|
6
|
+
*/
|
|
7
|
+
readonly finished: Promise<boolean>;
|
|
8
|
+
/** Stops playback. Each effect documents whether it preserves or restores its visual state. */
|
|
9
|
+
stop(): void;
|
|
10
|
+
}
|
|
11
|
+
/** Controls returned by animate() and decay(). Effects expose the base Animation. */
|
|
12
|
+
export interface PlaybackAnimation extends Animation {
|
|
13
|
+
/** Pauses only the properties owned by this animation. */
|
|
14
|
+
pause(): void;
|
|
15
|
+
/** Continues from the current position. Completed/stopped animations remain terminal. */
|
|
16
|
+
play(): void;
|
|
17
|
+
readonly paused: boolean;
|
|
18
|
+
/** Total milliseconds, including delays and repeats. Infinity for endless loops. */
|
|
19
|
+
readonly duration: number;
|
|
20
|
+
/** Finite timeline position, from 0 to 1. Seeking preserves the playing/paused state. */
|
|
21
|
+
progress: number;
|
|
22
|
+
}
|
|
23
|
+
export type PlaybackCommand = 'pause' | 'play' | 'seek';
|
|
24
|
+
export interface PlaybackClock {
|
|
25
|
+
time(): number;
|
|
26
|
+
pause(): void;
|
|
27
|
+
play(): void;
|
|
28
|
+
seek(ms: number): void;
|
|
29
|
+
cancel(): void;
|
|
30
|
+
}
|
|
31
|
+
/** Boundary notifications, never frame callbacks. Consumers sample this same clock. */
|
|
32
|
+
export interface PlaybackState {
|
|
33
|
+
readonly position?: number;
|
|
34
|
+
readonly time: number;
|
|
35
|
+
readonly duration: number;
|
|
36
|
+
readonly paused: boolean;
|
|
37
|
+
readonly ready: boolean;
|
|
38
|
+
readonly settled: boolean;
|
|
39
|
+
readonly completed: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Read only on user commands; there is no frame loop in JavaScript. */
|
|
42
|
+
export declare function createClock(now: () => number, initial?: number): PlaybackClock;
|
|
43
|
+
export declare function validateProgress(value: number, duration: number): void;
|
|
44
|
+
//# sourceMappingURL=playback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.d.ts","sourceRoot":"","sources":["../../src/core/playback.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAU,SAAQ,WAAW,CA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,MAAM,QAO/D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Read only on user commands; there is no frame loop in JavaScript. */
|
|
2
|
+
export function createClock(now, initial = 0) {
|
|
3
|
+
let offset = initial;
|
|
4
|
+
let anchor = now();
|
|
5
|
+
let paused = false;
|
|
6
|
+
const time = () => offset + (paused ? 0 : now() - anchor);
|
|
7
|
+
return {
|
|
8
|
+
time,
|
|
9
|
+
pause() {
|
|
10
|
+
offset = time();
|
|
11
|
+
paused = true;
|
|
12
|
+
},
|
|
13
|
+
play() {
|
|
14
|
+
if (paused) {
|
|
15
|
+
anchor = now();
|
|
16
|
+
paused = false;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
seek(ms) {
|
|
20
|
+
offset = ms;
|
|
21
|
+
anchor = now();
|
|
22
|
+
},
|
|
23
|
+
cancel() {
|
|
24
|
+
offset = time();
|
|
25
|
+
paused = true;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function validateProgress(value, duration) {
|
|
30
|
+
if (!Number.isFinite(value) || value < 0 || value > 1)
|
|
31
|
+
throw new RangeError('Animation progress must be between 0 and 1.');
|
|
32
|
+
if (!Number.isFinite(duration))
|
|
33
|
+
throw new RangeError('Progress requires a finite animation; endless loops can pause and play.');
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=playback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.js","sourceRoot":"","sources":["../../src/core/playback.ts"],"names":[],"mappings":"AA6CA,wEAAwE;AACxE,MAAM,UAAU,WAAW,CAAC,GAAiB,EAAE,OAAO,GAAG,CAAC;IACxD,IAAI,MAAM,GAAG,OAAO,CAAA;IACpB,IAAI,MAAM,GAAG,GAAG,EAAE,CAAA;IAClB,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAA;IACzD,OAAO;QACL,IAAI;QACJ,KAAK;YACH,MAAM,GAAG,IAAI,EAAE,CAAA;YACf,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;QACD,IAAI;YACF,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,GAAG,GAAG,EAAE,CAAA;gBACd,MAAM,GAAG,KAAK,CAAA;YAChB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,EAAE;YACL,MAAM,GAAG,EAAE,CAAA;YACX,MAAM,GAAG,GAAG,EAAE,CAAA;QAChB,CAAC;QACD,MAAM;YACJ,MAAM,GAAG,IAAI,EAAE,CAAA;YACf,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,QAAgB;IAC9D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC;QACnD,MAAM,IAAI,UAAU,CAAC,6CAA6C,CAAC,CAAA;IACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC5B,MAAM,IAAI,UAAU,CAClB,yEAAyE,CAC1E,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
export declare const presets: {
|
|
2
|
+
fadeIn: {
|
|
3
|
+
keyframes: {
|
|
4
|
+
opacity: number[];
|
|
5
|
+
};
|
|
6
|
+
transition: {
|
|
7
|
+
readonly duration: 300;
|
|
8
|
+
readonly ease: 'easeOut';
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
fadeInUp: {
|
|
12
|
+
keyframes: {
|
|
13
|
+
opacity: number[];
|
|
14
|
+
y: number[];
|
|
15
|
+
};
|
|
16
|
+
transition: {
|
|
17
|
+
type: 'spring';
|
|
18
|
+
duration: 500;
|
|
19
|
+
bounce: 0;
|
|
20
|
+
opacity: {
|
|
21
|
+
readonly duration: 300;
|
|
22
|
+
readonly ease: 'easeOut';
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
fadeInDown: {
|
|
27
|
+
keyframes: {
|
|
28
|
+
opacity: number[];
|
|
29
|
+
y: number[];
|
|
30
|
+
};
|
|
31
|
+
transition: {
|
|
32
|
+
type: 'spring';
|
|
33
|
+
duration: 500;
|
|
34
|
+
bounce: 0;
|
|
35
|
+
opacity: {
|
|
36
|
+
readonly duration: 300;
|
|
37
|
+
readonly ease: 'easeOut';
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
fadeInLeft: {
|
|
42
|
+
keyframes: {
|
|
43
|
+
opacity: number[];
|
|
44
|
+
x: number[];
|
|
45
|
+
};
|
|
46
|
+
transition: {
|
|
47
|
+
type: 'spring';
|
|
48
|
+
duration: 500;
|
|
49
|
+
bounce: 0;
|
|
50
|
+
opacity: {
|
|
51
|
+
readonly duration: 300;
|
|
52
|
+
readonly ease: 'easeOut';
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
fadeInRight: {
|
|
57
|
+
keyframes: {
|
|
58
|
+
opacity: number[];
|
|
59
|
+
x: number[];
|
|
60
|
+
};
|
|
61
|
+
transition: {
|
|
62
|
+
type: 'spring';
|
|
63
|
+
duration: 500;
|
|
64
|
+
bounce: 0;
|
|
65
|
+
opacity: {
|
|
66
|
+
readonly duration: 300;
|
|
67
|
+
readonly ease: 'easeOut';
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
zoomIn: {
|
|
72
|
+
keyframes: {
|
|
73
|
+
opacity: number[];
|
|
74
|
+
scale: number[];
|
|
75
|
+
};
|
|
76
|
+
transition: {
|
|
77
|
+
type: 'spring';
|
|
78
|
+
duration: 500;
|
|
79
|
+
bounce: 0;
|
|
80
|
+
opacity: {
|
|
81
|
+
readonly duration: 300;
|
|
82
|
+
readonly ease: 'easeOut';
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
popIn: {
|
|
87
|
+
keyframes: {
|
|
88
|
+
opacity: number[];
|
|
89
|
+
scale: number[];
|
|
90
|
+
};
|
|
91
|
+
transition: {
|
|
92
|
+
type: "spring";
|
|
93
|
+
duration: number;
|
|
94
|
+
bounce: number;
|
|
95
|
+
opacity: {
|
|
96
|
+
duration: number;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
flipInX: {
|
|
101
|
+
keyframes: {
|
|
102
|
+
opacity: number[];
|
|
103
|
+
rotateX: number[];
|
|
104
|
+
};
|
|
105
|
+
transition: {
|
|
106
|
+
type: "spring";
|
|
107
|
+
duration: number;
|
|
108
|
+
bounce: number;
|
|
109
|
+
opacity: {
|
|
110
|
+
duration: number;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
flipInY: {
|
|
115
|
+
keyframes: {
|
|
116
|
+
opacity: number[];
|
|
117
|
+
rotateY: number[];
|
|
118
|
+
};
|
|
119
|
+
transition: {
|
|
120
|
+
type: "spring";
|
|
121
|
+
duration: number;
|
|
122
|
+
bounce: number;
|
|
123
|
+
opacity: {
|
|
124
|
+
duration: number;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
fadeOut: {
|
|
129
|
+
keyframes: {
|
|
130
|
+
opacity: number;
|
|
131
|
+
};
|
|
132
|
+
transition: {
|
|
133
|
+
readonly duration: 200;
|
|
134
|
+
readonly ease: 'easeIn';
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
fadeOutUp: {
|
|
138
|
+
keyframes: {
|
|
139
|
+
opacity: number;
|
|
140
|
+
y: number;
|
|
141
|
+
};
|
|
142
|
+
transition: {
|
|
143
|
+
readonly duration: 200;
|
|
144
|
+
readonly ease: 'easeIn';
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
fadeOutDown: {
|
|
148
|
+
keyframes: {
|
|
149
|
+
opacity: number;
|
|
150
|
+
y: number;
|
|
151
|
+
};
|
|
152
|
+
transition: {
|
|
153
|
+
readonly duration: 200;
|
|
154
|
+
readonly ease: 'easeIn';
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
fadeOutLeft: {
|
|
158
|
+
keyframes: {
|
|
159
|
+
opacity: number;
|
|
160
|
+
x: number;
|
|
161
|
+
};
|
|
162
|
+
transition: {
|
|
163
|
+
readonly duration: 200;
|
|
164
|
+
readonly ease: 'easeIn';
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
fadeOutRight: {
|
|
168
|
+
keyframes: {
|
|
169
|
+
opacity: number;
|
|
170
|
+
x: number;
|
|
171
|
+
};
|
|
172
|
+
transition: {
|
|
173
|
+
readonly duration: 200;
|
|
174
|
+
readonly ease: 'easeIn';
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
zoomOut: {
|
|
178
|
+
keyframes: {
|
|
179
|
+
opacity: number;
|
|
180
|
+
scale: number;
|
|
181
|
+
};
|
|
182
|
+
transition: {
|
|
183
|
+
readonly duration: 200;
|
|
184
|
+
readonly ease: 'easeIn';
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
popOut: {
|
|
188
|
+
keyframes: {
|
|
189
|
+
opacity: number;
|
|
190
|
+
scale: (number | null)[];
|
|
191
|
+
};
|
|
192
|
+
transition: {
|
|
193
|
+
duration: number;
|
|
194
|
+
ease: ["easeOut", "easeIn"];
|
|
195
|
+
times: number[];
|
|
196
|
+
opacity: {
|
|
197
|
+
duration: number;
|
|
198
|
+
ease: "easeIn";
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
pulse: {
|
|
203
|
+
keyframes: {
|
|
204
|
+
scale: number[];
|
|
205
|
+
};
|
|
206
|
+
transition: {
|
|
207
|
+
duration: number;
|
|
208
|
+
ease: "easeInOut";
|
|
209
|
+
relative: true;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
bounce: {
|
|
213
|
+
keyframes: {
|
|
214
|
+
y: number[];
|
|
215
|
+
};
|
|
216
|
+
transition: {
|
|
217
|
+
duration: number;
|
|
218
|
+
relative: true;
|
|
219
|
+
times: number[];
|
|
220
|
+
ease: ["easeOut", "easeIn", "easeOut", "easeIn"];
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
shake: {
|
|
224
|
+
keyframes: {
|
|
225
|
+
x: number[];
|
|
226
|
+
};
|
|
227
|
+
transition: {
|
|
228
|
+
duration: number;
|
|
229
|
+
ease: "easeInOut";
|
|
230
|
+
relative: true;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
wiggle: {
|
|
234
|
+
keyframes: {
|
|
235
|
+
rotate: number[];
|
|
236
|
+
};
|
|
237
|
+
transition: {
|
|
238
|
+
duration: number;
|
|
239
|
+
ease: "easeInOut";
|
|
240
|
+
relative: true;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
heartbeat: {
|
|
244
|
+
keyframes: {
|
|
245
|
+
scale: number[];
|
|
246
|
+
};
|
|
247
|
+
transition: {
|
|
248
|
+
duration: number;
|
|
249
|
+
relative: true;
|
|
250
|
+
times: number[];
|
|
251
|
+
ease: "easeInOut";
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
jelly: {
|
|
255
|
+
keyframes: {
|
|
256
|
+
scaleX: number[];
|
|
257
|
+
scaleY: number[];
|
|
258
|
+
};
|
|
259
|
+
transition: {
|
|
260
|
+
duration: number;
|
|
261
|
+
relative: true;
|
|
262
|
+
times: number[];
|
|
263
|
+
ease: "easeInOut";
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
flash: {
|
|
267
|
+
keyframes: {
|
|
268
|
+
opacity: number[];
|
|
269
|
+
};
|
|
270
|
+
transition: {
|
|
271
|
+
duration: number;
|
|
272
|
+
ease: "easeInOut";
|
|
273
|
+
relative: true;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
tada: {
|
|
277
|
+
keyframes: {
|
|
278
|
+
scale: number[];
|
|
279
|
+
rotate: number[];
|
|
280
|
+
};
|
|
281
|
+
transition: {
|
|
282
|
+
duration: number;
|
|
283
|
+
ease: "easeInOut";
|
|
284
|
+
relative: true;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
spin: {
|
|
288
|
+
keyframes: {
|
|
289
|
+
rotate: number[];
|
|
290
|
+
};
|
|
291
|
+
transition: {
|
|
292
|
+
duration: number;
|
|
293
|
+
ease: "linear";
|
|
294
|
+
relative: true;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/core/presets.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,OAAO;;QACR,SAAS;YAAI,OAAO;;QAAY,UAAU;+BAL3B,GAAG;2BAAQ,SAAS;;;;;YAO9B,OAAO;YAAU,CAAC;;;kBALb,QAAQ;sBAAY,GAAG;oBAAU,CAAC;;;;;;;;;YASvC,OAAO;YAAU,CAAC;;;kBATb,QAAQ;sBAAY,GAAG;oBAAU,CAAC;;;;;;;;;YAavC,OAAO;YAAU,CAAC;;;kBAbb,QAAQ;sBAAY,GAAG;oBAAU,CAAC;;;;;;;;;YAiBvC,OAAO;YAAU,CAAC;;;kBAjBb,QAAQ;sBAAY,GAAG;oBAAU,CAAC;;;;;;;;;YAqBvC,OAAO;YAAU,KAAK;;;kBArBjB,QAAQ;sBAAY,GAAG;oBAAU,CAAC;;;;;;;;;YAyBvC,OAAO;YAAU,KAAK;;;;;;;gBAKtB,QAAQ;;;;;;YAIR,OAAO;YAAU,OAAO;;;;;;;gBAKxB,QAAQ;;;;;;YAIR,OAAO;YAAU,OAAO;;;;;;;gBAKxB,QAAQ;;;;;QAIZ,SAAS;YAAI,OAAO;;QAAO,UAAU;+BArDtB,GAAG;2BAAQ,QAAQ;;;;QAsDhC,SAAS;YAAI,OAAO;YAAK,CAAC;;QAAS,UAAU;;;;;;QAC3C,SAAS;YAAI,OAAO;YAAK,CAAC;;QAAQ,UAAU;;;;;;QAC5C,SAAS;YAAI,OAAO;YAAK,CAAC;;QAAS,UAAU;;;;;;QAC5C,SAAS;YAAI,OAAO;YAAK,CAAC;;QAAQ,UAAU;;;;;;QACjD,SAAS;YAAI,OAAO;YAAK,KAAK;;QAAU,UAAU;;;;;;;YAE9C,OAAO;YAAK,KAAK;;;;;;;;;;;;;;YAUjB,KAAK;;;;;;;;;;YAIL,CAAC;;;;;;;;;;;YASD,CAAC;;;;;;;;;;YAID,MAAM;;;;;;;;;;YAIN,KAAK;;;;;;;;;;;YAUhB,MAAM;YACN,MAAM;;;;;;;;;;;YAUK,OAAO;;;;;;;;;;YAKlB,KAAK;YACL,MAAM;;;;;;;;;;YAKK,MAAM;;;;;;;;CAGkB,CAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Motion recipes shared by the platform adapters. Registration remains runtime-owned.
|
|
2
|
+
const fadeIn = { duration: 300, ease: 'easeOut' };
|
|
3
|
+
const fadeOut = { duration: 200, ease: 'easeIn' };
|
|
4
|
+
const enter = { type: 'spring', duration: 500, bounce: 0 };
|
|
5
|
+
export const presets = {
|
|
6
|
+
fadeIn: { keyframes: { opacity: [0, 1] }, transition: fadeIn },
|
|
7
|
+
fadeInUp: {
|
|
8
|
+
keyframes: { opacity: [0, 1], y: [24, 0] },
|
|
9
|
+
transition: { ...enter, opacity: fadeIn },
|
|
10
|
+
},
|
|
11
|
+
fadeInDown: {
|
|
12
|
+
keyframes: { opacity: [0, 1], y: [-24, 0] },
|
|
13
|
+
transition: { ...enter, opacity: fadeIn },
|
|
14
|
+
},
|
|
15
|
+
fadeInLeft: {
|
|
16
|
+
keyframes: { opacity: [0, 1], x: [-24, 0] },
|
|
17
|
+
transition: { ...enter, opacity: fadeIn },
|
|
18
|
+
},
|
|
19
|
+
fadeInRight: {
|
|
20
|
+
keyframes: { opacity: [0, 1], x: [24, 0] },
|
|
21
|
+
transition: { ...enter, opacity: fadeIn },
|
|
22
|
+
},
|
|
23
|
+
zoomIn: {
|
|
24
|
+
keyframes: { opacity: [0, 1], scale: [0.85, 1] },
|
|
25
|
+
transition: { ...enter, opacity: fadeIn },
|
|
26
|
+
},
|
|
27
|
+
popIn: {
|
|
28
|
+
keyframes: { opacity: [0, 1], scale: [0.5, 1] },
|
|
29
|
+
transition: {
|
|
30
|
+
type: 'spring',
|
|
31
|
+
duration: 550,
|
|
32
|
+
bounce: 0.4,
|
|
33
|
+
opacity: { duration: 150 },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
flipInX: {
|
|
37
|
+
keyframes: { opacity: [0, 1], rotateX: [-90, 0] },
|
|
38
|
+
transition: {
|
|
39
|
+
type: 'spring',
|
|
40
|
+
duration: 600,
|
|
41
|
+
bounce: 0.25,
|
|
42
|
+
opacity: { duration: 200 },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
flipInY: {
|
|
46
|
+
keyframes: { opacity: [0, 1], rotateY: [90, 0] },
|
|
47
|
+
transition: {
|
|
48
|
+
type: 'spring',
|
|
49
|
+
duration: 600,
|
|
50
|
+
bounce: 0.25,
|
|
51
|
+
opacity: { duration: 200 },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
fadeOut: { keyframes: { opacity: 0 }, transition: fadeOut },
|
|
55
|
+
fadeOutUp: { keyframes: { opacity: 0, y: -24 }, transition: fadeOut },
|
|
56
|
+
fadeOutDown: { keyframes: { opacity: 0, y: 24 }, transition: fadeOut },
|
|
57
|
+
fadeOutLeft: { keyframes: { opacity: 0, x: -24 }, transition: fadeOut },
|
|
58
|
+
fadeOutRight: { keyframes: { opacity: 0, x: 24 }, transition: fadeOut },
|
|
59
|
+
zoomOut: { keyframes: { opacity: 0, scale: 0.85 }, transition: fadeOut },
|
|
60
|
+
popOut: {
|
|
61
|
+
keyframes: { opacity: 0, scale: [null, 1.08, 0.4] },
|
|
62
|
+
transition: {
|
|
63
|
+
duration: 250,
|
|
64
|
+
ease: ['easeOut', 'easeIn'],
|
|
65
|
+
times: [0, 0.3, 1],
|
|
66
|
+
opacity: { duration: 250, ease: 'easeIn' },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
pulse: {
|
|
70
|
+
keyframes: { scale: [1, 1.06, 1] },
|
|
71
|
+
transition: { duration: 500, ease: 'easeInOut', relative: true },
|
|
72
|
+
},
|
|
73
|
+
bounce: {
|
|
74
|
+
keyframes: { y: [0, -18, 0, -8, 0] },
|
|
75
|
+
transition: {
|
|
76
|
+
duration: 650,
|
|
77
|
+
relative: true,
|
|
78
|
+
times: [0, 0.3, 0.6, 0.8, 1],
|
|
79
|
+
ease: ['easeOut', 'easeIn', 'easeOut', 'easeIn'],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
shake: {
|
|
83
|
+
keyframes: { x: [0, -10, 10, -8, 8, -4, 4, 0] },
|
|
84
|
+
transition: { duration: 500, ease: 'easeInOut', relative: true },
|
|
85
|
+
},
|
|
86
|
+
wiggle: {
|
|
87
|
+
keyframes: { rotate: [0, -8, 8, -5, 5, 0] },
|
|
88
|
+
transition: { duration: 500, ease: 'easeInOut', relative: true },
|
|
89
|
+
},
|
|
90
|
+
heartbeat: {
|
|
91
|
+
keyframes: { scale: [1, 1.15, 1, 1.15, 1, 1] },
|
|
92
|
+
transition: {
|
|
93
|
+
duration: 1000,
|
|
94
|
+
relative: true,
|
|
95
|
+
times: [0, 0.14, 0.28, 0.42, 0.7, 1],
|
|
96
|
+
ease: 'easeInOut',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
jelly: {
|
|
100
|
+
keyframes: {
|
|
101
|
+
scaleX: [1, 1.25, 0.75, 1.15, 0.95, 1.05, 1],
|
|
102
|
+
scaleY: [1, 0.75, 1.25, 0.85, 1.05, 0.95, 1],
|
|
103
|
+
},
|
|
104
|
+
transition: {
|
|
105
|
+
duration: 800,
|
|
106
|
+
relative: true,
|
|
107
|
+
times: [0, 0.3, 0.4, 0.5, 0.65, 0.75, 1],
|
|
108
|
+
ease: 'easeInOut',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
flash: {
|
|
112
|
+
keyframes: { opacity: [1, 0, 1, 0, 1] },
|
|
113
|
+
transition: { duration: 800, ease: 'easeInOut', relative: true },
|
|
114
|
+
},
|
|
115
|
+
tada: {
|
|
116
|
+
keyframes: {
|
|
117
|
+
scale: [1, 0.9, 0.9, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1],
|
|
118
|
+
rotate: [0, -3, -3, 3, -3, 3, -3, 3, -3, 3, 0],
|
|
119
|
+
},
|
|
120
|
+
transition: { duration: 1000, ease: 'easeInOut', relative: true },
|
|
121
|
+
},
|
|
122
|
+
spin: {
|
|
123
|
+
keyframes: { rotate: [0, 360] },
|
|
124
|
+
transition: { duration: 1000, ease: 'linear', relative: true },
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=presets.js.map
|