cineview 0.0.1-beta
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/LICENSE +21 -0
- package/README.md +102 -0
- package/README.zh-CN.md +102 -0
- package/dist/animations/animationParser.d.ts +24 -0
- package/dist/animations/composer.d.ts +13 -0
- package/dist/animations/presets/blink.d.ts +18 -0
- package/dist/animations/presets/blur.d.ts +18 -0
- package/dist/animations/presets/bounce.d.ts +18 -0
- package/dist/animations/presets/elastic.d.ts +23 -0
- package/dist/animations/presets/fade.d.ts +18 -0
- package/dist/animations/presets/flip.d.ts +18 -0
- package/dist/animations/presets/index.d.ts +38 -0
- package/dist/animations/presets/rotate.d.ts +23 -0
- package/dist/animations/presets/shake.d.ts +28 -0
- package/dist/animations/presets/slide.d.ts +23 -0
- package/dist/animations/presets/special.d.ts +38 -0
- package/dist/animations/presets/zoom.d.ts +23 -0
- package/dist/animations/registry.d.ts +51 -0
- package/dist/artifacts.json +40 -0
- package/dist/blink-BGmsrTwW.mjs +81 -0
- package/dist/blur-CQoB_VWp.mjs +52 -0
- package/dist/bounce-B_QJxgOq.mjs +64 -0
- package/dist/cineview-dev.css +2 -0
- package/dist/cineview-dev.es.mjs +2 -0
- package/dist/cineview-drag.umd.js +2 -0
- package/dist/cineview-scroll.umd.js +2 -0
- package/dist/cineview.es.mjs +2 -0
- package/dist/cineview.umd.js +2 -0
- package/dist/components/Animate/Animate.d.ts +67 -0
- package/dist/components/Animate/AnimateRenderBridge.d.ts +16 -0
- package/dist/components/Animate/AnimateVideo.d.ts +59 -0
- package/dist/components/Animate/StaggerContainer.d.ts +35 -0
- package/dist/components/Animate/__fixtures__/animate-media-public-path.fixture.d.ts +1 -0
- package/dist/components/Animate/animateInterpolation.d.ts +41 -0
- package/dist/components/Animate/animateRenderState.d.ts +23 -0
- package/dist/components/Animate/animateSemantics.d.ts +38 -0
- package/dist/components/Animate/animateTimeline.d.ts +14 -0
- package/dist/components/Animate/dragVisualState.d.ts +26 -0
- package/dist/components/Animate/index.d.ts +6 -0
- package/dist/components/Animate/useAnimateArrival.d.ts +35 -0
- package/dist/components/Animate/useAnimateDrag.d.ts +34 -0
- package/dist/components/Animate/useAnimatePublicTimeline.d.ts +16 -0
- package/dist/components/Animate/useAnimateScroll.d.ts +83 -0
- package/dist/components/Animate/useAnimatedPropertyLanes.d.ts +30 -0
- package/dist/components/Animate/visibilityScheduler.d.ts +12 -0
- package/dist/components/Cineview/Cineview.d.ts +46 -0
- package/dist/components/Cineview/CineviewDispatch.d.ts +2 -0
- package/dist/components/Cineview/DirectScrollCineview.d.ts +8 -0
- package/dist/components/Cineview/DragSceneStack.d.ts +55 -0
- package/dist/components/Cineview/ScrollSceneSlot.d.ts +42 -0
- package/dist/components/Cineview/ScrollSceneStack.d.ts +13 -0
- package/dist/components/Cineview/ScrollbarOverlay.d.ts +24 -0
- package/dist/components/Cineview/directScrollHelpers.d.ts +77 -0
- package/dist/components/Cineview/index.d.ts +5 -0
- package/dist/components/Cineview/preloadTargets.d.ts +18 -0
- package/dist/components/Cineview/regroupCallbacks.d.ts +10 -0
- package/dist/components/Cineview/useCineviewImperativeApi.d.ts +21 -0
- package/dist/components/Cineview/useNativeScrollController.d.ts +38 -0
- package/dist/components/Cineview/useScrollInputBindings.d.ts +9 -0
- package/dist/components/Cineview/useScrollSceneLayout.d.ts +24 -0
- package/dist/components/Cineview/useScrollSceneSnapshots.d.ts +32 -0
- package/dist/components/Cineview/useScrollViewport.d.ts +20 -0
- package/dist/components/Cineview/useScrollZoneRegistry.d.ts +35 -0
- package/dist/components/Container/Container.d.ts +2 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Image/Image.d.ts +12 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Position/Position.d.ts +13 -0
- package/dist/components/Position/index.d.ts +1 -0
- package/dist/components/Scene/Scene.d.ts +10 -0
- package/dist/components/Scene/SceneFixedLayer.d.ts +14 -0
- package/dist/components/Scene/__fixtures__/scene-grouped-public-path.fixture.d.ts +1 -0
- package/dist/components/Scene/dragPreparedState.d.ts +49 -0
- package/dist/components/Scene/helpers.d.ts +101 -0
- package/dist/components/Scene/index.d.ts +1 -0
- package/dist/components/Scene/sceneScrollBudget.d.ts +38 -0
- package/dist/components/Scene/sceneScrollRuntime.d.ts +65 -0
- package/dist/components/Scene/types.d.ts +189 -0
- package/dist/components/Scene/useDragSceneEngine.d.ts +67 -0
- package/dist/components/Scene/useElementTrack.d.ts +82 -0
- package/dist/components/Scene/useNativePointerDrag.d.ts +25 -0
- package/dist/components/Scene/useSceneAnimationRegistry.d.ts +56 -0
- package/dist/components/Scene/useScenePointerInput.d.ts +28 -0
- package/dist/components/Scene/useSceneRuntimeState.d.ts +17 -0
- package/dist/components/Scene/useSceneScrollTakeover.d.ts +13 -0
- package/dist/components/Scene/useScrollSceneEngine.d.ts +28 -0
- package/dist/components/runtime/runtimeContext.d.ts +14 -0
- package/dist/components/runtime/scrollExternalStore.d.ts +13 -0
- package/dist/components/runtime/scrollSceneFrameStore.d.ts +29 -0
- package/dist/context/CineviewContext.d.ts +25 -0
- package/dist/dev/PerfPanel.d.ts +16 -0
- package/dist/dev/index.d.ts +14 -0
- package/dist/dev/usePerfMonitor.d.ts +9 -0
- package/dist/drag-scene-engine-y8Wj9ivV.mjs +270 -0
- package/dist/elastic-CBP_FdRv.mjs +129 -0
- package/dist/element-track-Du10P12_.mjs +316 -0
- package/dist/entry-drag.d.ts +14 -0
- package/dist/entry-scroll.d.ts +14 -0
- package/dist/fade-DXxFsgxR.mjs +22 -0
- package/dist/flip-CrCoNIws.mjs +49 -0
- package/dist/hooks/imagePreloadCache.d.ts +4 -0
- package/dist/hooks/mediaPreloadCache.d.ts +31 -0
- package/dist/hooks/useFirstSceneEnter.d.ts +65 -0
- package/dist/hooks/useImagePreloader.d.ts +31 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/useSceneManager.d.ts +79 -0
- package/dist/index.d.ts +17 -0
- package/dist/media/VideoFrameRenderer.d.ts +48 -0
- package/dist/media/videoPlaybackOwnership.d.ts +63 -0
- package/dist/performance-monitor-AlOOwzY_.mjs +73 -0
- package/dist/public-api.d.ts +12 -0
- package/dist/rotate-BMEBKDk5.mjs +69 -0
- package/dist/scene-animation-registry-8b0m_IaZ.mjs +422 -0
- package/dist/shake-BV6SdR9O.mjs +171 -0
- package/dist/slide-DWmVtj0L.mjs +63 -0
- package/dist/special-DDz8BopB.mjs +224 -0
- package/dist/types/index.d.ts +552 -0
- package/dist/utils/animationHelpers.d.ts +15 -0
- package/dist/utils/debounce.d.ts +18 -0
- package/dist/utils/devLog.d.ts +16 -0
- package/dist/utils/dragTimelineMapping.d.ts +30 -0
- package/dist/utils/gestureDetector.d.ts +67 -0
- package/dist/utils/performanceMonitor.d.ts +66 -0
- package/dist/utils/styleConvert.d.ts +7 -0
- package/dist/utils/useIsomorphicLayoutEffect.d.ts +22 -0
- package/dist/utils/useStructurallyStableValue.d.ts +5 -0
- package/dist/zoom-CuAthpqd.mjs +63 -0
- package/package.json +171 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ScrollTimelineState } from '../../types';
|
|
2
|
+
import { ScrollInputDirection } from '../Cineview/directScrollHelpers';
|
|
3
|
+
/**
|
|
4
|
+
* Continuous values for one scroll Scene. This channel is deliberately
|
|
5
|
+
* separate from the React render snapshot: the native scroll controller is the
|
|
6
|
+
* only writer, while Scene consumers subscribe imperatively (MotionValue or
|
|
7
|
+
* direct DOM updates) and do not schedule a React render for every pixel.
|
|
8
|
+
*/
|
|
9
|
+
export interface ScrollSceneFrame {
|
|
10
|
+
timelineState: ScrollTimelineState | null;
|
|
11
|
+
/** Scene-level normalized progress used by legacy/no-timeline consumers. */
|
|
12
|
+
progress: number;
|
|
13
|
+
/** Continuous scroll-zone budget progress (kept out of the React snapshot lane). */
|
|
14
|
+
zoneProgressPx: number | null;
|
|
15
|
+
visualViewportOffset: number;
|
|
16
|
+
isCurrent: boolean;
|
|
17
|
+
isBackdropActive: boolean;
|
|
18
|
+
isScrolling: boolean;
|
|
19
|
+
scrollDirection: ScrollInputDirection | null;
|
|
20
|
+
}
|
|
21
|
+
export type ScrollSceneFrameList = readonly (ScrollSceneFrame | undefined)[];
|
|
22
|
+
export interface ScrollSceneFrameStore {
|
|
23
|
+
setSnapshot: (next: ScrollSceneFrameList) => void;
|
|
24
|
+
setKeySnapshot: (sceneIndex: number, next: ScrollSceneFrame | undefined) => void;
|
|
25
|
+
clearFrom: (sceneCount: number) => void;
|
|
26
|
+
getKeySnapshot: (sceneIndex: number) => ScrollSceneFrame | undefined;
|
|
27
|
+
subscribeKey: (sceneIndex: number, listener: () => void) => () => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function createScrollSceneFrameStore(): ScrollSceneFrameStore;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CineviewContextValue {
|
|
3
|
+
/** px2vw single-ruler ratio: `viewportWidth / size`. Only useAnimateScroll gate margin conversion reads this. */
|
|
4
|
+
scale: number;
|
|
5
|
+
/** px2vw single-ruler conversion: design px → physical px (`size * scale`). Shared by all length values. */
|
|
6
|
+
convert: (size: number) => number;
|
|
7
|
+
}
|
|
8
|
+
declare const CineviewContext: React.Context<CineviewContextValue | null>;
|
|
9
|
+
export { CineviewContext };
|
|
10
|
+
export interface CineviewProviderProps {
|
|
11
|
+
/** Design spec size baseline (design px). Single conversion ruler site-wide: `scale = viewportWidth / designSize`. */
|
|
12
|
+
designSize?: number;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const CineviewProvider: React.FC<CineviewProviderProps>;
|
|
16
|
+
/**
|
|
17
|
+
* Use Cineview context
|
|
18
|
+
*/
|
|
19
|
+
export declare const useCineviewContext: () => CineviewContextValue | null;
|
|
20
|
+
/**
|
|
21
|
+
* Use size conversion function
|
|
22
|
+
* Convenience hook for directly obtaining the convert function (px2vw single ruler) in components.
|
|
23
|
+
* Returns stable identity function (no conversion) when used outside Cineview, with one-time dev warning.
|
|
24
|
+
*/
|
|
25
|
+
export declare const useConvertSize: () => ((size: number) => number);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PerformanceSource } from './usePerfMonitor';
|
|
2
|
+
export interface PerfPanelProps {
|
|
3
|
+
/** 面板位置 */
|
|
4
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
/** 是否默认展开 */
|
|
6
|
+
defaultExpanded?: boolean;
|
|
7
|
+
/** Public Cineview ref (usually captured from callbacks.onReady). */
|
|
8
|
+
source?: PerformanceSource | null;
|
|
9
|
+
/** Disable polling while the panel is hidden. */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Allow the panel to be moved away from content it covers. */
|
|
12
|
+
draggable?: boolean;
|
|
13
|
+
/** Display labels in the site's active language. */
|
|
14
|
+
lang?: 'en' | 'zh';
|
|
15
|
+
}
|
|
16
|
+
export declare function PerfPanel({ position, defaultExpanded, source, enabled, draggable, lang, }: PerfPanelProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 开发者工具导出
|
|
3
|
+
*
|
|
4
|
+
* 包含:
|
|
5
|
+
* - PerfPanel: 实时性能监控面板
|
|
6
|
+
*
|
|
7
|
+
* 使用:
|
|
8
|
+
* import { PerfPanel } from 'cineview/dev';
|
|
9
|
+
* import 'cineview/dev/style.css';
|
|
10
|
+
*/
|
|
11
|
+
export { PerfPanel } from './PerfPanel';
|
|
12
|
+
export type { PerfPanelProps } from './PerfPanel';
|
|
13
|
+
export { usePerfMonitor } from './usePerfMonitor';
|
|
14
|
+
export type { PerfStats, PerformanceSource } from './usePerfMonitor';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CineviewRef, PerformanceMetrics } from '../types';
|
|
2
|
+
/** Public Cineview ref methods consumed by development tools. */
|
|
3
|
+
export type PerformanceSource = Pick<CineviewRef, 'getPerformanceMetrics'>;
|
|
4
|
+
export interface PerfStats {
|
|
5
|
+
current: PerformanceMetrics;
|
|
6
|
+
history: readonly PerformanceMetrics[];
|
|
7
|
+
}
|
|
8
|
+
/** Subscribe to shared, 500ms snapshots from a Cineview ref with `monitor` enabled. */
|
|
9
|
+
export declare function usePerfMonitor(source: PerformanceSource | null | undefined, enabled?: boolean): PerfStats | null;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { useCallback as Q, useEffect as yt, useRef as $ } from "react";
|
|
2
|
+
import { animate as kt } from "framer-motion";
|
|
3
|
+
function ft() {
|
|
4
|
+
return !1;
|
|
5
|
+
}
|
|
6
|
+
function Ht(n, u) {
|
|
7
|
+
ft();
|
|
8
|
+
}
|
|
9
|
+
function Mt(n, u) {
|
|
10
|
+
const e = u?.minVelocity ?? 0, b = u?.maxVelocity ?? 1e3, I = u?.minRatio ?? 0.15, d = u?.maxRatio ?? 0.3;
|
|
11
|
+
if (!Number.isFinite(n)) return d;
|
|
12
|
+
const B = b - e;
|
|
13
|
+
return B <= 0 ? d : d - (Math.max(e, Math.min(b, n)) - e) / B * (d - I);
|
|
14
|
+
}
|
|
15
|
+
function _t(n, u) {
|
|
16
|
+
const e = n === "y" ? u.velocity.y : u.velocity.x;
|
|
17
|
+
return Number.isFinite(e) ? -e : 0;
|
|
18
|
+
}
|
|
19
|
+
function Ot({ slideMode: n, isActive: u, sceneIndex: e, currentSceneIndex: b, totalScenes: I, slideDirection: d, slideDuration: B, sceneTransitionDuration: $t, sceneOffset: D, sceneState: g, globalDirection: ot, globalRenderProgress: h, globalIsDragging: st, globalDragProgress: lt, globalDragTimelineProgress: at, controls: it, dragProgressMotion: s, setSceneState: U, setIsAnimating: w, resolveDragProgress: Z, getTimelineDuration: pt, onDragProgressChange: V, onRenderProgressChange: L, onDragTimelineProgressChange: E, onOwnershipRequest: tt, onCandidateSuspensionChange: O, takeoverSnapshot: et, onDraggingChange: H, onDragRelease: v, renderLaneRef: Bt, completeReleaseImmediately: q = !1, onDragEnd: rt, onDragReset: A, thresholdConfig: dt }) {
|
|
20
|
+
const mt = $(null), bt = $(null), P = $(0), Vt = $(null), r = Bt ?? Vt, G = $(!1), C = $(0), W = $(!1), ut = $(!1);
|
|
21
|
+
return yt(() => {
|
|
22
|
+
if (n !== "drag") return;
|
|
23
|
+
it.set({
|
|
24
|
+
opacity: 1,
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0,
|
|
27
|
+
scale: 1,
|
|
28
|
+
rotate: 0
|
|
29
|
+
});
|
|
30
|
+
const f = h, c = st || Math.abs(f) > 1e-3, o = f > 0 ? "forward" : f < 0 ? "backward" : ot, t = u ? c ? "exiting" : "active" : o === "forward" && D === 1 || o === "backward" && D === -1 ? "entering" : "initial";
|
|
31
|
+
g !== t && (Ht(`🎬 [Scene ${e}] State transition: ${g} -> ${t} (drag mode sync)`), U(t));
|
|
32
|
+
}, [
|
|
33
|
+
n,
|
|
34
|
+
it,
|
|
35
|
+
u,
|
|
36
|
+
g,
|
|
37
|
+
e,
|
|
38
|
+
h,
|
|
39
|
+
st,
|
|
40
|
+
D,
|
|
41
|
+
ot,
|
|
42
|
+
U
|
|
43
|
+
]), yt(() => () => {
|
|
44
|
+
P.current += 1;
|
|
45
|
+
const f = r.current;
|
|
46
|
+
f && f.ownerSceneIndex === e && (f.stop(), r.current = null), G.current = !1, W.current = !1;
|
|
47
|
+
}, [r, e]), {
|
|
48
|
+
handleCandidateSuspend: Q(() => {
|
|
49
|
+
if (n !== "drag") return !1;
|
|
50
|
+
const f = r.current, c = !!f?.suspend;
|
|
51
|
+
W.current = c, f?.suspend?.();
|
|
52
|
+
const o = O?.(!0) ?? !1;
|
|
53
|
+
return c || o;
|
|
54
|
+
}, [
|
|
55
|
+
r,
|
|
56
|
+
O,
|
|
57
|
+
n
|
|
58
|
+
]),
|
|
59
|
+
handleCandidateResume: Q(() => {
|
|
60
|
+
r.current?.resume?.(), W.current = !1, O?.(!1);
|
|
61
|
+
}, [r, O]),
|
|
62
|
+
handleDragStart: Q((f) => {
|
|
63
|
+
if (n !== "drag") return !1;
|
|
64
|
+
const c = r.current;
|
|
65
|
+
if (!u && !c || tt && !tt(f)) return !1;
|
|
66
|
+
const o = c && W.current ? c.getCurrent?.() ?? h : h, t = et?.current;
|
|
67
|
+
return t && t.baseRatio === null && (et.current = {
|
|
68
|
+
...t,
|
|
69
|
+
baseRatio: Math.abs(o)
|
|
70
|
+
}), O?.(!1), c ? (c.preempt ? c.preempt() : c.stop(), r.current = null, W.current = !1, C.current = o, ut.current = !0, s.set(o), V?.(o), E?.(Math.abs(o)), `${e}${c.kind}`, o.toFixed(3)) : (C.current = 0, ut.current = !1), G.current = !0, `${e}`, lt.toFixed(3), at.toFixed(3), H?.(!0), !0;
|
|
71
|
+
}, [
|
|
72
|
+
n,
|
|
73
|
+
u,
|
|
74
|
+
r,
|
|
75
|
+
tt,
|
|
76
|
+
s,
|
|
77
|
+
V,
|
|
78
|
+
E,
|
|
79
|
+
H,
|
|
80
|
+
e,
|
|
81
|
+
b,
|
|
82
|
+
I,
|
|
83
|
+
lt,
|
|
84
|
+
at,
|
|
85
|
+
h,
|
|
86
|
+
O,
|
|
87
|
+
et
|
|
88
|
+
]),
|
|
89
|
+
handlePan: Q((f, c) => {
|
|
90
|
+
if (n !== "drag" || !u && !G.current) return;
|
|
91
|
+
const o = d === "y" ? c.offset.y : c.offset.x, t = Z(C.current - o / (d === "y" ? window.innerHeight : window.innerWidth)), T = Math.abs(t);
|
|
92
|
+
if (s.set(t), V?.(t), E?.(T), L?.(t), ft()) {
|
|
93
|
+
const X = Math.round(Math.abs(t) * 10) / 10;
|
|
94
|
+
mt.current !== X && (mt.current = X);
|
|
95
|
+
}
|
|
96
|
+
}, [
|
|
97
|
+
n,
|
|
98
|
+
u,
|
|
99
|
+
d,
|
|
100
|
+
e,
|
|
101
|
+
V,
|
|
102
|
+
E,
|
|
103
|
+
L,
|
|
104
|
+
s,
|
|
105
|
+
Z
|
|
106
|
+
]),
|
|
107
|
+
handlePanEnd: Q((f, c) => {
|
|
108
|
+
if (n !== "drag" || !u && !G.current) return;
|
|
109
|
+
G.current = !1;
|
|
110
|
+
const o = f.type === "pointercancel";
|
|
111
|
+
P.current += 1, r.current?.stop(), r.current = null;
|
|
112
|
+
const t = s.get(), T = pt(), X = _t(d, c), j = Math.abs(X), y = Math.abs(t), Ft = (F, _) => {
|
|
113
|
+
let Y = null, i = s.get(), m = 0, l = !1, a = !1;
|
|
114
|
+
const N = F / Math.max(Math.abs(i), 1e-6), p = () => {
|
|
115
|
+
a || l || r.current !== R || (r.current = null, Y?.stop(), i = 0, s.set(0), V?.(0), E?.(0), L?.(0), _());
|
|
116
|
+
}, x = () => {
|
|
117
|
+
if (a || l || r.current !== R) return;
|
|
118
|
+
const J = Math.abs(i) * N;
|
|
119
|
+
if (J <= 1e-6) {
|
|
120
|
+
p();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const S = ++m;
|
|
124
|
+
Y = kt(s, 0, {
|
|
125
|
+
duration: J,
|
|
126
|
+
ease: "easeOut",
|
|
127
|
+
onUpdate: (k) => {
|
|
128
|
+
S !== m || a || l || (i = k, s.set(k), V?.(k), E?.(Math.abs(k)), L?.(k));
|
|
129
|
+
},
|
|
130
|
+
onComplete: () => {
|
|
131
|
+
S === m && (i = 0, p());
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}, z = () => {
|
|
135
|
+
a = !0, l = !1, m += 1, Y?.stop();
|
|
136
|
+
}, R = {
|
|
137
|
+
kind: "bounce",
|
|
138
|
+
ownerSceneIndex: e,
|
|
139
|
+
stop: z,
|
|
140
|
+
suspend: () => {
|
|
141
|
+
a || l || (i = s.get(), l = !0, m += 1, Y?.stop());
|
|
142
|
+
},
|
|
143
|
+
resume: () => {
|
|
144
|
+
a || !l || (i = s.get(), l = !1, x());
|
|
145
|
+
},
|
|
146
|
+
preempt: z,
|
|
147
|
+
getCurrent: () => i
|
|
148
|
+
};
|
|
149
|
+
r.current = R, x();
|
|
150
|
+
};
|
|
151
|
+
if (y < 1e-3) {
|
|
152
|
+
if (`${e}`, t.toFixed(3), A?.(), ut.current) {
|
|
153
|
+
const F = C.current >= 0 ? "forward" : "backward";
|
|
154
|
+
v?.({
|
|
155
|
+
mode: "bounce",
|
|
156
|
+
direction: F,
|
|
157
|
+
targetSceneIndex: F === "forward" ? b + 1 : b - 1
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
H?.(!1), u && U("active");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const M = t > 0 ? "forward" : "backward", ct = M === "forward" ? b + 1 : b - 1;
|
|
164
|
+
if (Z(t) === 0 && t !== 0) {
|
|
165
|
+
w(!0), `${e}`, t.toFixed(3), j.toFixed(1), H?.(!1), v?.({
|
|
166
|
+
mode: "bounce",
|
|
167
|
+
direction: M,
|
|
168
|
+
targetSceneIndex: ct
|
|
169
|
+
}), Ft(0.15, () => {
|
|
170
|
+
A?.(), U("active"), w(!1);
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const nt = q ? 0.5 : Mt(j, dt);
|
|
175
|
+
`${e}`, j.toFixed(1), nt.toFixed(3), y.toFixed(3);
|
|
176
|
+
const Lt = y > 1e-3 && t * X < 0 && j > 600, Et = !o && y > nt && (q || !Lt);
|
|
177
|
+
if (`${e}`, t.toFixed(3), y.toFixed(3), nt.toFixed(3), j.toFixed(1), X.toFixed(1), Et) {
|
|
178
|
+
if (w(!0), H?.(!1), q) {
|
|
179
|
+
rt?.(M, 1, T, T), w(!1);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const F = ++P.current, _ = M === "forward" ? 1 : -1, Y = Math.abs(_ - t), i = Math.max(Y * (B / 1e3), 0), m = Math.min(y, 1);
|
|
183
|
+
v?.({
|
|
184
|
+
mode: "settle",
|
|
185
|
+
direction: M,
|
|
186
|
+
targetSceneIndex: ct,
|
|
187
|
+
progressRatio: y
|
|
188
|
+
});
|
|
189
|
+
let l = null, a = t, N = 0, p = !1, x = !1;
|
|
190
|
+
const z = () => {
|
|
191
|
+
x || p || r.current !== S || (r.current = null, l?.stop(), `${e}`, m.toFixed(3), (i * 1e3).toFixed(1), rt?.(M, m, m * T, T), L?.(0), w(!1));
|
|
192
|
+
}, R = () => {
|
|
193
|
+
if (x || p || r.current !== S) return;
|
|
194
|
+
const k = Math.abs(_ - a) * (B / 1e3);
|
|
195
|
+
if (k <= 1e-6) {
|
|
196
|
+
z();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const xt = ++N;
|
|
200
|
+
l = kt(a, _, {
|
|
201
|
+
duration: k,
|
|
202
|
+
ease: "easeOut",
|
|
203
|
+
onUpdate: (K) => {
|
|
204
|
+
if (!(xt !== N || x || p || P.current !== F) && (a = K, Math.abs(K - _) > 1e-6 && s.set(K), L?.(K), ft())) {
|
|
205
|
+
const wt = Math.round(Math.abs(K) * 10) / 10;
|
|
206
|
+
bt.current !== wt && (bt.current = wt);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
onComplete: () => {
|
|
210
|
+
xt === N && (a = _, z());
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}, J = () => {
|
|
214
|
+
x = !0, p = !1, N += 1, l?.stop();
|
|
215
|
+
}, S = {
|
|
216
|
+
kind: "settle",
|
|
217
|
+
ownerSceneIndex: e,
|
|
218
|
+
stop: J,
|
|
219
|
+
suspend: () => {
|
|
220
|
+
x || p || (p = !0, N += 1, l?.stop());
|
|
221
|
+
},
|
|
222
|
+
resume: () => {
|
|
223
|
+
x || !p || (p = !1, R());
|
|
224
|
+
},
|
|
225
|
+
preempt: J,
|
|
226
|
+
getCurrent: () => a
|
|
227
|
+
};
|
|
228
|
+
`${e}`, t.toFixed(3), (i * 1e3).toFixed(1), m.toFixed(3), r.current = S, R();
|
|
229
|
+
} else {
|
|
230
|
+
w(!0);
|
|
231
|
+
const F = Math.min(y * B, 300) / 1e3;
|
|
232
|
+
`${e}`, t.toFixed(3), (F * 1e3).toFixed(1), H?.(!1), v?.({
|
|
233
|
+
mode: "bounce",
|
|
234
|
+
direction: M,
|
|
235
|
+
targetSceneIndex: ct
|
|
236
|
+
}), Ft(F, () => {
|
|
237
|
+
A?.(), w(!1);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}, [
|
|
241
|
+
n,
|
|
242
|
+
u,
|
|
243
|
+
r,
|
|
244
|
+
d,
|
|
245
|
+
e,
|
|
246
|
+
b,
|
|
247
|
+
B,
|
|
248
|
+
s,
|
|
249
|
+
V,
|
|
250
|
+
E,
|
|
251
|
+
L,
|
|
252
|
+
v,
|
|
253
|
+
rt,
|
|
254
|
+
A,
|
|
255
|
+
H,
|
|
256
|
+
Z,
|
|
257
|
+
pt,
|
|
258
|
+
$t,
|
|
259
|
+
w,
|
|
260
|
+
U,
|
|
261
|
+
q,
|
|
262
|
+
dt
|
|
263
|
+
])
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
export {
|
|
267
|
+
Ot as t
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
//# sourceMappingURL=drag-scene-engine-y8Wj9ivV.mjs.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
var t = {
|
|
2
|
+
elastic: {
|
|
3
|
+
initial: {
|
|
4
|
+
scale: 0,
|
|
5
|
+
opacity: 0
|
|
6
|
+
},
|
|
7
|
+
animate: {
|
|
8
|
+
scale: 1,
|
|
9
|
+
opacity: 1,
|
|
10
|
+
transition: {
|
|
11
|
+
type: "spring",
|
|
12
|
+
stiffness: 300,
|
|
13
|
+
damping: 10
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
exit: {
|
|
17
|
+
scale: 0,
|
|
18
|
+
opacity: 0
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"rubber-band": {
|
|
22
|
+
initial: { scale: 1 },
|
|
23
|
+
animate: {
|
|
24
|
+
scale: [
|
|
25
|
+
1,
|
|
26
|
+
1.25,
|
|
27
|
+
0.75,
|
|
28
|
+
1.15,
|
|
29
|
+
0.95,
|
|
30
|
+
1
|
|
31
|
+
],
|
|
32
|
+
transition: {
|
|
33
|
+
duration: 1,
|
|
34
|
+
times: [
|
|
35
|
+
0,
|
|
36
|
+
0.3,
|
|
37
|
+
0.4,
|
|
38
|
+
0.5,
|
|
39
|
+
0.65,
|
|
40
|
+
1
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
exit: {
|
|
45
|
+
scale: 0,
|
|
46
|
+
opacity: 0
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
wobble: {
|
|
50
|
+
initial: {
|
|
51
|
+
x: 0,
|
|
52
|
+
rotate: 0
|
|
53
|
+
},
|
|
54
|
+
animate: {
|
|
55
|
+
x: [
|
|
56
|
+
0,
|
|
57
|
+
-25,
|
|
58
|
+
20,
|
|
59
|
+
-15,
|
|
60
|
+
10,
|
|
61
|
+
-5,
|
|
62
|
+
0
|
|
63
|
+
],
|
|
64
|
+
rotate: [
|
|
65
|
+
0,
|
|
66
|
+
-5,
|
|
67
|
+
3,
|
|
68
|
+
-3,
|
|
69
|
+
2,
|
|
70
|
+
-1,
|
|
71
|
+
0
|
|
72
|
+
],
|
|
73
|
+
transition: {
|
|
74
|
+
duration: 1,
|
|
75
|
+
times: [
|
|
76
|
+
0,
|
|
77
|
+
0.15,
|
|
78
|
+
0.3,
|
|
79
|
+
0.45,
|
|
80
|
+
0.6,
|
|
81
|
+
0.75,
|
|
82
|
+
1
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
exit: {
|
|
87
|
+
x: 0,
|
|
88
|
+
rotate: 0,
|
|
89
|
+
opacity: 0
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
swing: {
|
|
93
|
+
initial: {
|
|
94
|
+
rotate: 0,
|
|
95
|
+
transformOrigin: "top center"
|
|
96
|
+
},
|
|
97
|
+
animate: {
|
|
98
|
+
rotate: [
|
|
99
|
+
0,
|
|
100
|
+
15,
|
|
101
|
+
-10,
|
|
102
|
+
5,
|
|
103
|
+
-5,
|
|
104
|
+
0
|
|
105
|
+
],
|
|
106
|
+
transformOrigin: "top center",
|
|
107
|
+
transition: {
|
|
108
|
+
duration: 1,
|
|
109
|
+
times: [
|
|
110
|
+
0,
|
|
111
|
+
0.2,
|
|
112
|
+
0.4,
|
|
113
|
+
0.6,
|
|
114
|
+
0.8,
|
|
115
|
+
1
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
exit: {
|
|
120
|
+
rotate: 0,
|
|
121
|
+
opacity: 0
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
t as elasticAnimations
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=elastic-CBP_FdRv.mjs.map
|