react-native-smooth-clip-view 0.2.2 → 0.2.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 +52 -14
- package/android/CMakeLists.txt +4 -0
- package/android/build.gradle +1 -0
- package/android/src/main/cpp/SmoothClipRegistry.cpp +72 -53
- package/cpp/SmoothClipVelocityTracker.h +101 -0
- package/ios/SmoothClipView.mm +32 -74
- package/lib/module/drivers.android.js +3 -1
- package/lib/module/drivers.android.js.map +1 -1
- package/lib/module/drivers.ios.js +3 -377
- package/lib/module/drivers.ios.js.map +1 -1
- package/lib/module/drivers.js +8 -0
- package/lib/module/drivers.js.map +1 -1
- package/lib/module/drivers.native.js +401 -0
- package/lib/module/drivers.native.js.map +1 -0
- package/lib/module/easings.js +35 -0
- package/lib/module/easings.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/src/driverTypes.d.ts +34 -3
- package/lib/typescript/src/driverTypes.d.ts.map +1 -1
- package/lib/typescript/src/drivers.android.d.ts +2 -2
- package/lib/typescript/src/drivers.android.d.ts.map +1 -1
- package/lib/typescript/src/drivers.d.ts.map +1 -1
- package/lib/typescript/src/drivers.ios.d.ts +2 -4
- package/lib/typescript/src/drivers.ios.d.ts.map +1 -1
- package/lib/typescript/src/drivers.native.d.ts +5 -0
- package/lib/typescript/src/drivers.native.d.ts.map +1 -0
- package/lib/typescript/src/easings.d.ts +33 -0
- package/lib/typescript/src/easings.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +1 -0
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/driverTypes.ts +53 -19
- package/src/drivers.android.ts +4 -2
- package/src/drivers.ios.ts +4 -661
- package/src/drivers.native.ts +698 -0
- package/src/drivers.ts +11 -0
- package/src/easings.ts +32 -0
- package/src/index.ts +1 -0
- package/src/index.web.ts +1 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// The shared NATIVE driver: iOS and Android both execute this file, via the
|
|
4
|
+
// one-line re-exports in drivers.ios.ts / drivers.android.ts that Metro's
|
|
5
|
+
// platform resolution picks up from index.ts's `./drivers` import. Only the
|
|
6
|
+
// `./smoothClipNative` import below is platform-split. drivers.ts (no
|
|
7
|
+
// suffix) is the web/Reanimated fallback, not this driver's sibling.
|
|
8
|
+
import { useEffect, useRef } from 'react';
|
|
9
|
+
import { useSharedValue } from 'react-native-reanimated';
|
|
10
|
+
import { isRNRuntime, scheduleOnRN, scheduleOnUI } from 'react-native-worklets';
|
|
11
|
+
import NativeSmoothClipModule from './smoothClipNative';
|
|
12
|
+
import { allocateDriverId, attachDriverState, createDriverState, detachDriverState, getDriverState, setDriverState } from "./driverState.js";
|
|
13
|
+
import { completeNativeAnimation, synchronizeNativeCompletion } from "./nativeCompletion.js";
|
|
14
|
+
import { clipPresentationEquals, createClipPresentation, isFiniteClipPresentation } from "./geometry.js";
|
|
15
|
+
import { createReactRequest, rejectDriverRequests, resolveReactRequest } from "./reactRequests.js";
|
|
16
|
+
const INTERACTIVE = 0;
|
|
17
|
+
const NATIVE = 1;
|
|
18
|
+
const setPresentationHostFunction = NativeSmoothClipModule.setClipPresentation;
|
|
19
|
+
const beginInteractionHostFunction = NativeSmoothClipModule.beginInteraction;
|
|
20
|
+
const animateTimingHostFunction = NativeSmoothClipModule.animateTiming;
|
|
21
|
+
const animateSpringHostFunction = NativeSmoothClipModule.animateSpring;
|
|
22
|
+
const animateKeyframesHostFunction = NativeSmoothClipModule.animateKeyframes;
|
|
23
|
+
const rejectAnimationHostFunction = NativeSmoothClipModule.rejectAnimation;
|
|
24
|
+
const cancelAnimationHostFunction = NativeSmoothClipModule.cancelAnimation;
|
|
25
|
+
const destroyDriverHostFunction = NativeSmoothClipModule.destroyDriver;
|
|
26
|
+
|
|
27
|
+
// Workaround for react-native-worklets 0.10: the RN-side serialization cache
|
|
28
|
+
// hands out one remote-function registry id per function forever, but the
|
|
29
|
+
// registry entry is deleted as soon as any transient UI-side proxy of that
|
|
30
|
+
// function is garbage collected. A later scheduleOnRN for the same function
|
|
31
|
+
// then reads `undefined` from the registry and aborts in Value::getObject.
|
|
32
|
+
// Pinning one UI-side reference for the app lifetime keeps the proxy — and
|
|
33
|
+
// with it the registry entry — alive. Remove once worklets decouples registry
|
|
34
|
+
// cleanup from proxy lifetime.
|
|
35
|
+
scheduleOnUI(resolver => {
|
|
36
|
+
'worklet';
|
|
37
|
+
|
|
38
|
+
globalThis.__smoothClipPinnedResolver = resolver;
|
|
39
|
+
}, resolveReactRequest);
|
|
40
|
+
function reduceMotionCode(value) {
|
|
41
|
+
switch (value) {
|
|
42
|
+
case 'always':
|
|
43
|
+
return 1;
|
|
44
|
+
case 'never':
|
|
45
|
+
return 2;
|
|
46
|
+
default:
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function animationIsFinite(target, animation) {
|
|
51
|
+
'worklet';
|
|
52
|
+
|
|
53
|
+
if (animation.from !== undefined && !isFiniteClipPresentation(animation.from)) {
|
|
54
|
+
// Silently dropping an invalid explicit start would re-open the exact
|
|
55
|
+
// stale-start handoff `from` exists to close — reject the whole call.
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (animation.type === 'timing') {
|
|
59
|
+
return Number.isFinite(animation.duration) && animation.controlPoints.every(Number.isFinite);
|
|
60
|
+
}
|
|
61
|
+
if (animation.type === 'spring') {
|
|
62
|
+
return [animation.mass ?? 1, animation.stiffness ?? 100, animation.damping ?? 10, animation.initialVelocity === 'inherit' ? 0 : animation.initialVelocity ?? 0].every(Number.isFinite);
|
|
63
|
+
}
|
|
64
|
+
if (!Number.isFinite(animation.duration) || animation.frames.length < 2) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
let previousOffset = -1;
|
|
68
|
+
for (const frame of animation.frames) {
|
|
69
|
+
if (!Number.isFinite(frame.offset) || frame.offset < 0 || frame.offset > 1 || frame.offset <= previousOffset || !isFiniteClipPresentation(frame.presentation)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
previousOffset = frame.offset;
|
|
73
|
+
}
|
|
74
|
+
return animation.frames[0]?.offset === 0 && previousOffset === 1 && clipPresentationEquals(animation.frames[animation.frames.length - 1]?.presentation ?? null, target);
|
|
75
|
+
}
|
|
76
|
+
function presentationFromNative(values, fallback, offset = 0) {
|
|
77
|
+
'worklet';
|
|
78
|
+
|
|
79
|
+
if (values.length < offset + 7) return fallback;
|
|
80
|
+
const presentation = {
|
|
81
|
+
clip: {
|
|
82
|
+
x: values[offset],
|
|
83
|
+
y: values[offset + 1],
|
|
84
|
+
width: values[offset + 2],
|
|
85
|
+
height: values[offset + 3],
|
|
86
|
+
radius: values[offset + 4]
|
|
87
|
+
},
|
|
88
|
+
contentTranslateX: values[offset + 5],
|
|
89
|
+
contentTranslateY: values[offset + 6]
|
|
90
|
+
};
|
|
91
|
+
return isFiniteClipPresentation(presentation) ? presentation : fallback;
|
|
92
|
+
}
|
|
93
|
+
function flattenedKeyframes(animation) {
|
|
94
|
+
'worklet';
|
|
95
|
+
|
|
96
|
+
const values = [];
|
|
97
|
+
for (const frame of animation.frames) {
|
|
98
|
+
const {
|
|
99
|
+
clip,
|
|
100
|
+
contentTranslateX,
|
|
101
|
+
contentTranslateY
|
|
102
|
+
} = frame.presentation;
|
|
103
|
+
values.push(frame.offset, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY);
|
|
104
|
+
}
|
|
105
|
+
return values;
|
|
106
|
+
}
|
|
107
|
+
function uiOnly() {
|
|
108
|
+
'worklet';
|
|
109
|
+
|
|
110
|
+
throw new Error('[SmoothClipView] driver.ui methods must run on the UI runtime. Use driver.react from React code.');
|
|
111
|
+
}
|
|
112
|
+
export function useSmoothClipDriver(initialValue, options = {}) {
|
|
113
|
+
const initialPresentation = 'clip' in initialValue ? initialValue : createClipPresentation(initialValue);
|
|
114
|
+
const presentation = useSharedValue(initialPresentation);
|
|
115
|
+
const ownership = useSharedValue(INTERACTIVE);
|
|
116
|
+
const suppressDeliveries = useSharedValue(0);
|
|
117
|
+
const activeAnimationId = useSharedValue(0);
|
|
118
|
+
// Non-zero after a setScalars hot write: driver.presentation is then stale,
|
|
119
|
+
// so animateTo must start from the native registry's latest value instead
|
|
120
|
+
// of snapping back to the stale SharedValue.
|
|
121
|
+
const scalarsStale = useSharedValue(0);
|
|
122
|
+
const callbackRef = useRef(options.onAnimationComplete);
|
|
123
|
+
const driverRef = useRef(null);
|
|
124
|
+
callbackRef.current = options.onAnimationComplete;
|
|
125
|
+
if (driverRef.current === null) {
|
|
126
|
+
const driverId = allocateDriverId();
|
|
127
|
+
const reduceMotion = reduceMotionCode(options.reduceMotion ?? 'system');
|
|
128
|
+
const seedPresentation = next => {
|
|
129
|
+
'worklet';
|
|
130
|
+
|
|
131
|
+
if (!clipPresentationEquals(presentation.value, next)) {
|
|
132
|
+
suppressDeliveries.value += 1;
|
|
133
|
+
presentation.value = next;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const beginOnUI = () => {
|
|
137
|
+
'worklet';
|
|
138
|
+
|
|
139
|
+
const current = presentationFromNative(beginInteractionHostFunction(driverId), presentation.value);
|
|
140
|
+
activeAnimationId.value = 0;
|
|
141
|
+
ownership.value = INTERACTIVE;
|
|
142
|
+
scalarsStale.value = 0;
|
|
143
|
+
seedPresentation(current);
|
|
144
|
+
return current;
|
|
145
|
+
};
|
|
146
|
+
const setOnUI = next => {
|
|
147
|
+
'worklet';
|
|
148
|
+
|
|
149
|
+
if (!isFiniteClipPresentation(next)) return;
|
|
150
|
+
activeAnimationId.value = 0;
|
|
151
|
+
ownership.value = INTERACTIVE;
|
|
152
|
+
scalarsStale.value = 0;
|
|
153
|
+
const {
|
|
154
|
+
clip,
|
|
155
|
+
contentTranslateX,
|
|
156
|
+
contentTranslateY
|
|
157
|
+
} = next;
|
|
158
|
+
setPresentationHostFunction(driverId, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY, true);
|
|
159
|
+
seedPresentation(next);
|
|
160
|
+
};
|
|
161
|
+
const setScalarsOnUI = (x, y, width, height, radius, contentTranslateX, contentTranslateY) => {
|
|
162
|
+
'worklet';
|
|
163
|
+
|
|
164
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(width) || !Number.isFinite(height) || !Number.isFinite(radius) || !Number.isFinite(contentTranslateX) || !Number.isFinite(contentTranslateY)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (activeAnimationId.value !== 0) activeAnimationId.value = 0;
|
|
168
|
+
if (ownership.value !== INTERACTIVE) ownership.value = INTERACTIVE;
|
|
169
|
+
if (scalarsStale.value === 0) scalarsStale.value = 1;
|
|
170
|
+
setPresentationHostFunction(driverId, x, y, width, height, radius, contentTranslateX, contentTranslateY, true);
|
|
171
|
+
};
|
|
172
|
+
const animateOnUI = (target, animation) => {
|
|
173
|
+
'worklet';
|
|
174
|
+
|
|
175
|
+
if (!isFiniteClipPresentation(target) || !animationIsFinite(target, animation)) {
|
|
176
|
+
return rejectAnimationHostFunction(driverId);
|
|
177
|
+
}
|
|
178
|
+
const from = animation.from;
|
|
179
|
+
if (from !== undefined) {
|
|
180
|
+
// Fused hot write: exactly setScalars(from…) issued immediately
|
|
181
|
+
// before the handoff, so native's latest value — the animation
|
|
182
|
+
// start below — is the caller's explicit presentation. Also
|
|
183
|
+
// re-grabs from a running animation, which the implicit
|
|
184
|
+
// interactive-start path would silently skip.
|
|
185
|
+
setScalarsOnUI(from.clip.x, from.clip.y, from.clip.width, from.clip.height, from.clip.radius, from.contentTranslateX, from.contentTranslateY);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// After a setScalars hot write the SharedValue no longer matches what
|
|
189
|
+
// is on screen; passing it as the start would snap the animation back.
|
|
190
|
+
// Without an interactive start, native resolves the start from its own
|
|
191
|
+
// latest value instead.
|
|
192
|
+
const scalarsWereStale = scalarsStale.value !== 0;
|
|
193
|
+
const hasInteractiveStart = ownership.value === INTERACTIVE && !scalarsWereStale;
|
|
194
|
+
const start = presentation.value;
|
|
195
|
+
ownership.value = NATIVE;
|
|
196
|
+
presentation.value = target;
|
|
197
|
+
scalarsStale.value = 0;
|
|
198
|
+
const startClip = start.clip;
|
|
199
|
+
const targetClip = target.clip;
|
|
200
|
+
let animationId;
|
|
201
|
+
if (animation.type === 'timing') {
|
|
202
|
+
const [x1, y1, x2, y2] = animation.controlPoints;
|
|
203
|
+
animationId = animateTimingHostFunction(driverId, hasInteractiveStart, startClip.x, startClip.y, startClip.width, startClip.height, startClip.radius, start.contentTranslateX, start.contentTranslateY, targetClip.x, targetClip.y, targetClip.width, targetClip.height, targetClip.radius, target.contentTranslateX, target.contentTranslateY, Math.max(0, animation.duration), x1, y1, x2, y2, reduceMotion);
|
|
204
|
+
} else if (animation.type === 'spring') {
|
|
205
|
+
const inheritVelocity = animation.initialVelocity === undefined || animation.initialVelocity === 'inherit';
|
|
206
|
+
animationId = animateSpringHostFunction(driverId, hasInteractiveStart, startClip.x, startClip.y, startClip.width, startClip.height, startClip.radius, start.contentTranslateX, start.contentTranslateY, targetClip.x, targetClip.y, targetClip.width, targetClip.height, targetClip.radius, target.contentTranslateX, target.contentTranslateY, Math.max(0.0001, animation.mass ?? 1), Math.max(0.0001, animation.stiffness ?? 100), Math.max(0, animation.damping ?? 10), inheritVelocity ? 0 : animation.initialVelocity, inheritVelocity, reduceMotion);
|
|
207
|
+
} else {
|
|
208
|
+
animationId = animateKeyframesHostFunction(driverId, hasInteractiveStart, startClip.x, startClip.y, startClip.width, startClip.height, startClip.radius, start.contentTranslateX, start.contentTranslateY, targetClip.x, targetClip.y, targetClip.width, targetClip.height, targetClip.radius, target.contentTranslateX, target.contentTranslateY, Math.max(0, animation.duration), flattenedKeyframes(animation), reduceMotion);
|
|
209
|
+
}
|
|
210
|
+
if (animationId === 0) {
|
|
211
|
+
// The 0 sentinel: the driver entry no longer exists (destroyed) or
|
|
212
|
+
// the call ran off the main thread — validation failures never get
|
|
213
|
+
// here (they reject before any side effect with a fresh id and one
|
|
214
|
+
// finished:false completion). Restore the two-call-desugar state and
|
|
215
|
+
// forward the registry's rejection result, which is 0 again in both
|
|
216
|
+
// reachable cases, with no completion — exactly the README contract.
|
|
217
|
+
ownership.value = INTERACTIVE;
|
|
218
|
+
presentation.value = start;
|
|
219
|
+
if (scalarsWereStale) scalarsStale.value = 1;
|
|
220
|
+
activeAnimationId.value = 0;
|
|
221
|
+
return rejectAnimationHostFunction(driverId);
|
|
222
|
+
}
|
|
223
|
+
activeAnimationId.value = animationId;
|
|
224
|
+
return animationId;
|
|
225
|
+
};
|
|
226
|
+
const cancelOnUI = (animationId = 0, behavior = 'current') => {
|
|
227
|
+
'worklet';
|
|
228
|
+
|
|
229
|
+
const values = cancelAnimationHostFunction(driverId, animationId, behavior === 'target' ? 1 : 0);
|
|
230
|
+
if (values.length < 8 || values[0] !== 1) return presentation.value;
|
|
231
|
+
const current = presentationFromNative(values, presentation.value, 1);
|
|
232
|
+
activeAnimationId.value = 0;
|
|
233
|
+
ownership.value = INTERACTIVE;
|
|
234
|
+
scalarsStale.value = 0;
|
|
235
|
+
seedPresentation(current);
|
|
236
|
+
return current;
|
|
237
|
+
};
|
|
238
|
+
const driver = {
|
|
239
|
+
kind: 'hybrid',
|
|
240
|
+
presentation,
|
|
241
|
+
ui: {
|
|
242
|
+
beginInteraction() {
|
|
243
|
+
'worklet';
|
|
244
|
+
|
|
245
|
+
if (isRNRuntime()) return uiOnly();
|
|
246
|
+
return beginOnUI();
|
|
247
|
+
},
|
|
248
|
+
set(next) {
|
|
249
|
+
'worklet';
|
|
250
|
+
|
|
251
|
+
if (isRNRuntime()) return uiOnly();
|
|
252
|
+
setOnUI(next);
|
|
253
|
+
},
|
|
254
|
+
setScalars(x, y, width, height, radius, contentTranslateX, contentTranslateY) {
|
|
255
|
+
'worklet';
|
|
256
|
+
|
|
257
|
+
if (isRNRuntime()) return uiOnly();
|
|
258
|
+
setScalarsOnUI(x, y, width, height, radius, contentTranslateX, contentTranslateY);
|
|
259
|
+
},
|
|
260
|
+
animateTo(target, animation) {
|
|
261
|
+
'worklet';
|
|
262
|
+
|
|
263
|
+
if (isRNRuntime()) return uiOnly();
|
|
264
|
+
return animateOnUI(target, animation);
|
|
265
|
+
},
|
|
266
|
+
cancel(animationId = 0, behavior = 'current') {
|
|
267
|
+
'worklet';
|
|
268
|
+
|
|
269
|
+
if (isRNRuntime()) return uiOnly();
|
|
270
|
+
return cancelOnUI(animationId, behavior);
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
react: {
|
|
274
|
+
beginInteraction() {
|
|
275
|
+
const {
|
|
276
|
+
requestId,
|
|
277
|
+
promise
|
|
278
|
+
} = createReactRequest(driverId);
|
|
279
|
+
scheduleOnUI(() => {
|
|
280
|
+
'worklet';
|
|
281
|
+
|
|
282
|
+
const result = beginOnUI();
|
|
283
|
+
scheduleOnRN(resolveReactRequest, driverId, requestId, result);
|
|
284
|
+
});
|
|
285
|
+
return promise;
|
|
286
|
+
},
|
|
287
|
+
set(next) {
|
|
288
|
+
const {
|
|
289
|
+
requestId,
|
|
290
|
+
promise
|
|
291
|
+
} = createReactRequest(driverId);
|
|
292
|
+
scheduleOnUI(() => {
|
|
293
|
+
'worklet';
|
|
294
|
+
|
|
295
|
+
setOnUI(next);
|
|
296
|
+
scheduleOnRN(resolveReactRequest, driverId, requestId, undefined);
|
|
297
|
+
});
|
|
298
|
+
return promise;
|
|
299
|
+
},
|
|
300
|
+
animateTo(target, animation) {
|
|
301
|
+
const {
|
|
302
|
+
requestId,
|
|
303
|
+
promise
|
|
304
|
+
} = createReactRequest(driverId, true);
|
|
305
|
+
scheduleOnUI(() => {
|
|
306
|
+
'worklet';
|
|
307
|
+
|
|
308
|
+
const result = animateOnUI(target, animation);
|
|
309
|
+
scheduleOnRN(resolveReactRequest, driverId, requestId, result, true);
|
|
310
|
+
});
|
|
311
|
+
return promise;
|
|
312
|
+
},
|
|
313
|
+
cancel(animationId = 0, behavior = 'current') {
|
|
314
|
+
const {
|
|
315
|
+
requestId,
|
|
316
|
+
promise
|
|
317
|
+
} = createReactRequest(driverId, true);
|
|
318
|
+
scheduleOnUI(() => {
|
|
319
|
+
'worklet';
|
|
320
|
+
|
|
321
|
+
const result = cancelOnUI(animationId, behavior);
|
|
322
|
+
scheduleOnRN(resolveReactRequest, driverId, requestId, result, true);
|
|
323
|
+
});
|
|
324
|
+
return promise;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
setDriverState(driver, createDriverState(driverId, initialPresentation, presentation, callbackRef, activeAnimationId, ownership));
|
|
329
|
+
driverRef.current = driver;
|
|
330
|
+
}
|
|
331
|
+
const driver = driverRef.current;
|
|
332
|
+
useEffect(() => {
|
|
333
|
+
const currentDriver = driverRef.current;
|
|
334
|
+
if (!currentDriver) return undefined;
|
|
335
|
+
const state = getDriverState(currentDriver);
|
|
336
|
+
const {
|
|
337
|
+
driverId
|
|
338
|
+
} = state;
|
|
339
|
+
// Re-attach on every effect run: StrictMode/<Activity> replay the effect
|
|
340
|
+
// after its cleanup detached this state and destroyed the native driver.
|
|
341
|
+
// The authoritative seed below recreates the native entry in that case.
|
|
342
|
+
attachDriverState(state);
|
|
343
|
+
const subscription = NativeSmoothClipModule.onClipAnimationComplete(result => {
|
|
344
|
+
if (result.driverId !== driverId) return;
|
|
345
|
+
synchronizeNativeCompletion(activeAnimationId, ownership, result.animationId, result.finished);
|
|
346
|
+
completeNativeAnimation(driverId, result.animationId, result.finished);
|
|
347
|
+
});
|
|
348
|
+
scheduleOnUI((source, listenerId, nativeDriverId, owner, suppressed, active, stale, setter) => {
|
|
349
|
+
'worklet';
|
|
350
|
+
|
|
351
|
+
let last = null;
|
|
352
|
+
const deliver = next => {
|
|
353
|
+
if (!isFiniteClipPresentation(next) || clipPresentationEquals(last, next)) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
// Record `last` only for values native has actually observed:
|
|
357
|
+
// deliveries dropped during native ownership must stay eligible
|
|
358
|
+
// for re-delivery once interactive ownership returns.
|
|
359
|
+
if (owner.value !== INTERACTIVE) return;
|
|
360
|
+
if (suppressed.value > 0) {
|
|
361
|
+
suppressed.value -= 1;
|
|
362
|
+
last = next;
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
last = next;
|
|
366
|
+
if (stale.value !== 0) stale.value = 0;
|
|
367
|
+
const {
|
|
368
|
+
clip,
|
|
369
|
+
contentTranslateX,
|
|
370
|
+
contentTranslateY
|
|
371
|
+
} = next;
|
|
372
|
+
setter(nativeDriverId, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY, false);
|
|
373
|
+
};
|
|
374
|
+
source.addListener(listenerId, deliver);
|
|
375
|
+
// Authoritative take-ownership seed. Creates the native entry before
|
|
376
|
+
// any view mounts on the first run, and revives a driver destroyed by
|
|
377
|
+
// an effect-replay cleanup (StrictMode/<Activity>) on later runs.
|
|
378
|
+
const current = source.value;
|
|
379
|
+
if (isFiniteClipPresentation(current)) {
|
|
380
|
+
active.value = 0;
|
|
381
|
+
owner.value = INTERACTIVE;
|
|
382
|
+
stale.value = 0;
|
|
383
|
+
last = current;
|
|
384
|
+
setter(nativeDriverId, current.clip.x, current.clip.y, current.clip.width, current.clip.height, current.clip.radius, current.contentTranslateX, current.contentTranslateY, true);
|
|
385
|
+
}
|
|
386
|
+
}, presentation, driverId, driverId, ownership, suppressDeliveries, activeAnimationId, scalarsStale, setPresentationHostFunction);
|
|
387
|
+
return () => {
|
|
388
|
+
subscription.remove();
|
|
389
|
+
rejectDriverRequests(driverId);
|
|
390
|
+
detachDriverState(state);
|
|
391
|
+
scheduleOnUI((source, listenerId, nativeDriverId, destroy) => {
|
|
392
|
+
'worklet';
|
|
393
|
+
|
|
394
|
+
source.removeListener(listenerId);
|
|
395
|
+
destroy(nativeDriverId);
|
|
396
|
+
}, presentation, driverId, driverId, destroyDriverHostFunction);
|
|
397
|
+
};
|
|
398
|
+
}, [activeAnimationId, ownership, presentation, scalarsStale, suppressDeliveries]);
|
|
399
|
+
return driver;
|
|
400
|
+
}
|
|
401
|
+
//# sourceMappingURL=drivers.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useSharedValue","isRNRuntime","scheduleOnRN","scheduleOnUI","NativeSmoothClipModule","allocateDriverId","attachDriverState","createDriverState","detachDriverState","getDriverState","setDriverState","completeNativeAnimation","synchronizeNativeCompletion","clipPresentationEquals","createClipPresentation","isFiniteClipPresentation","createReactRequest","rejectDriverRequests","resolveReactRequest","INTERACTIVE","NATIVE","setPresentationHostFunction","setClipPresentation","beginInteractionHostFunction","beginInteraction","animateTimingHostFunction","animateTiming","animateSpringHostFunction","animateSpring","animateKeyframesHostFunction","animateKeyframes","rejectAnimationHostFunction","rejectAnimation","cancelAnimationHostFunction","cancelAnimation","destroyDriverHostFunction","destroyDriver","resolver","globalThis","__smoothClipPinnedResolver","reduceMotionCode","value","animationIsFinite","target","animation","from","undefined","type","Number","isFinite","duration","controlPoints","every","mass","stiffness","damping","initialVelocity","frames","length","previousOffset","frame","offset","presentation","presentationFromNative","values","fallback","clip","x","y","width","height","radius","contentTranslateX","contentTranslateY","flattenedKeyframes","push","uiOnly","Error","useSmoothClipDriver","initialValue","options","initialPresentation","ownership","suppressDeliveries","activeAnimationId","scalarsStale","callbackRef","onAnimationComplete","driverRef","current","driverId","reduceMotion","seedPresentation","next","beginOnUI","setOnUI","setScalarsOnUI","animateOnUI","scalarsWereStale","hasInteractiveStart","start","startClip","targetClip","animationId","x1","y1","x2","y2","Math","max","inheritVelocity","cancelOnUI","behavior","driver","kind","ui","set","setScalars","animateTo","cancel","react","requestId","promise","result","currentDriver","state","subscription","onClipAnimationComplete","finished","source","listenerId","nativeDriverId","owner","suppressed","active","stale","setter","last","deliver","addListener","remove","destroy","removeListener"],"sourceRoot":"../../src","sources":["drivers.native.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,cAAc,QAA0B,yBAAyB;AAC1E,SAASC,WAAW,EAAEC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAC/E,OAAOC,sBAAsB,MAAM,oBAAoB;AAUvD,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBAAiB,EACjBC,cAAc,EACdC,cAAc,QACT,kBAAe;AACtB,SACEC,uBAAuB,EACvBC,2BAA2B,QACtB,uBAAoB;AAC3B,SACEC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,QAGnB,eAAY;AACnB,SACEC,kBAAkB,EAClBC,oBAAoB,EACpBC,mBAAmB,QACd,oBAAiB;AAExB,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,MAAM,GAAG,CAAC;AAEhB,MAAMC,2BAA2B,GAAGjB,sBAAsB,CAACkB,mBAAmB;AAC9E,MAAMC,4BAA4B,GAAGnB,sBAAsB,CAACoB,gBAAgB;AAC5E,MAAMC,yBAAyB,GAAGrB,sBAAsB,CAACsB,aAAa;AACtE,MAAMC,yBAAyB,GAAGvB,sBAAsB,CAACwB,aAAa;AACtE,MAAMC,4BAA4B,GAAGzB,sBAAsB,CAAC0B,gBAAgB;AAC5E,MAAMC,2BAA2B,GAAG3B,sBAAsB,CAAC4B,eAAe;AAC1E,MAAMC,2BAA2B,GAAG7B,sBAAsB,CAAC8B,eAAe;AAC1E,MAAMC,yBAAyB,GAAG/B,sBAAsB,CAACgC,aAAa;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAjC,YAAY,CAAEkC,QAAoC,IAAK;EACrD,SAAS;;EACRC,UA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
+
|
|
3
|
+
/**
|
|
4
|
+
* Exact cubic-Bézier control points for the standard polynomial easings, for
|
|
5
|
+
* use as `TimingClipAnimation.controlPoints`.
|
|
6
|
+
*
|
|
7
|
+
* Native transitions and a parallel Reanimated animation (content driven by
|
|
8
|
+
* `withTiming` alongside a native `animateTo`) only stay in sync when both
|
|
9
|
+
* sides run the identical curve. Each entry below is the exact single-Bézier
|
|
10
|
+
* form of the matching Reanimated easing — not an approximation — so pairing
|
|
11
|
+
* e.g. `Easing.out(Easing.cubic)` with `ClipEasings.easeOutCubic` is
|
|
12
|
+
* mathematically lossless:
|
|
13
|
+
*
|
|
14
|
+
* - `linear` ↔ `Easing.linear`
|
|
15
|
+
* - `easeInQuad` ↔ `Easing.in(Easing.quad)`
|
|
16
|
+
* - `easeOutQuad` ↔ `Easing.out(Easing.quad)`
|
|
17
|
+
* - `easeInCubic` ↔ `Easing.in(Easing.cubic)`
|
|
18
|
+
* - `easeOutCubic` ↔ `Easing.out(Easing.cubic)`
|
|
19
|
+
*
|
|
20
|
+
* With x-control-points at 1/3 and 2/3 the Bézier's x(t) is the identity, so
|
|
21
|
+
* y(t) is the easing polynomial itself (e.g. `easeOutCubic`: y = 1 − (1−t)³).
|
|
22
|
+
*
|
|
23
|
+
* `Easing.inOut(Easing.cubic)` (and the other `inOut` polynomials) are
|
|
24
|
+
* piecewise and have NO exact single-Bézier form — for those, define one
|
|
25
|
+
* `Easing.bezier(x1, y1, x2, y2)` and pass the same four numbers as
|
|
26
|
+
* `controlPoints` so both sides share the same (approximated) curve.
|
|
27
|
+
*/
|
|
28
|
+
export const ClipEasings = {
|
|
29
|
+
linear: [0, 0, 1, 1],
|
|
30
|
+
easeInQuad: [1 / 3, 0, 2 / 3, 1 / 3],
|
|
31
|
+
easeOutQuad: [1 / 3, 2 / 3, 2 / 3, 1],
|
|
32
|
+
easeInCubic: [1 / 3, 0, 2 / 3, 0],
|
|
33
|
+
easeOutCubic: [1 / 3, 1, 2 / 3, 1]
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=easings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ClipEasings","linear","easeInQuad","easeOutQuad","easeInCubic","easeOutCubic"],"sourceRoot":"../../src","sources":["easings.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG;EACzBC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACpBC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;EACpCC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;EACrCC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;EACjCC,YAAY,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AACnC,CAA8E","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
export { SmoothClipView } from './SmoothClipView';
|
|
4
4
|
export { useSmoothClipDriver } from './drivers';
|
|
5
|
+
export { ClipEasings } from "./easings.js";
|
|
5
6
|
export { normalizeClipGeometry } from "./geometry.js";
|
|
6
7
|
export { createClipPresentation } from "./geometry.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SmoothClipView","useSmoothClipDriver","normalizeClipGeometry","createClipPresentation"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,mBAAmB,QAAQ,WAAW;AAa/C,SAASC,qBAAqB,QAAQ,eAAY;AAClD,SAASC,sBAAsB,QAAQ,eAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["SmoothClipView","useSmoothClipDriver","ClipEasings","normalizeClipGeometry","createClipPresentation"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,mBAAmB,QAAQ,WAAW;AAa/C,SAASC,WAAW,QAAQ,cAAW;AACvC,SAASC,qBAAqB,QAAQ,eAAY;AAClD,SAASC,sBAAsB,QAAQ,eAAY","ignoreList":[]}
|
package/lib/module/index.web.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
export { SmoothClipView } from "./SmoothClipView.web.js";
|
|
4
4
|
export { useSmoothClipDriver } from './drivers';
|
|
5
|
+
export { ClipEasings } from "./easings.js";
|
|
5
6
|
export { normalizeClipGeometry } from "./geometry.js";
|
|
6
7
|
export { createClipPresentation } from "./geometry.js";
|
|
7
8
|
//# sourceMappingURL=index.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SmoothClipView","useSmoothClipDriver","normalizeClipGeometry","createClipPresentation"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,yBAAsB;AAErD,SAASC,mBAAmB,QAAQ,WAAW;AAa/C,SAASC,qBAAqB,QAAQ,eAAY;AAClD,SAASC,sBAAsB,QAAQ,eAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["SmoothClipView","useSmoothClipDriver","ClipEasings","normalizeClipGeometry","createClipPresentation"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,yBAAsB;AAErD,SAASC,mBAAmB,QAAQ,WAAW;AAa/C,SAASC,WAAW,QAAQ,cAAW;AACvC,SAASC,qBAAqB,QAAQ,eAAY;AAClD,SAASC,sBAAsB,QAAQ,eAAY","ignoreList":[]}
|
|
@@ -1,19 +1,46 @@
|
|
|
1
1
|
import type { SharedValue } from 'react-native-reanimated';
|
|
2
2
|
import type { SmoothClipPresentation } from './geometry.js';
|
|
3
3
|
export type ClipReduceMotion = 'system' | 'always' | 'never';
|
|
4
|
-
|
|
4
|
+
/** Options shared by every animation kind. */
|
|
5
|
+
type ClipAnimationBase = Readonly<{
|
|
6
|
+
/**
|
|
7
|
+
* Explicit start: fuses a `setScalars(from…)` take-ownership hot write
|
|
8
|
+
* immediately before the animation, so native starts from exactly this
|
|
9
|
+
* presentation instead of its last delivered value. Use at a gesture
|
|
10
|
+
* release when the freshest sample (e.g. the UP event's position) never
|
|
11
|
+
* reached native — a gated per-frame reaction may not have flushed it.
|
|
12
|
+
* Also re-grabs from a running animation (which an implicit interactive
|
|
13
|
+
* start would silently skip). Non-finite `from` rejects the whole call.
|
|
14
|
+
* On the native drivers `driver.presentation.value` is not written from
|
|
15
|
+
* `from` (it stays stale until success sets it to the target); the web
|
|
16
|
+
* fallback does write it — its presentation SharedValue is the render
|
|
17
|
+
* channel itself. Against a held pending-animation latch the seed is
|
|
18
|
+
* dropped by design — latch intent wins.
|
|
19
|
+
*
|
|
20
|
+
* Keyframes interpolate absolutely, so pass `frames[0].presentation` —
|
|
21
|
+
* the seed renders it before the first animation frame, making the
|
|
22
|
+
* handoff continuous.
|
|
23
|
+
*
|
|
24
|
+
* iOS note: keyframes start exactly at `from` (frame 0 travels in-band);
|
|
25
|
+
* timing/spring sample their Core Animation from-value off the
|
|
26
|
+
* presentation layer — the last committed frame, at most one frame behind
|
|
27
|
+
* `from` — identical to the two-call pattern this option desugars to.
|
|
28
|
+
*/
|
|
29
|
+
from?: SmoothClipPresentation;
|
|
30
|
+
}>;
|
|
31
|
+
export type TimingClipAnimation = ClipAnimationBase & Readonly<{
|
|
5
32
|
type: 'timing';
|
|
6
33
|
duration: number;
|
|
7
34
|
controlPoints: readonly [number, number, number, number];
|
|
8
35
|
}>;
|
|
9
|
-
export type SpringClipAnimation = Readonly<{
|
|
36
|
+
export type SpringClipAnimation = ClipAnimationBase & Readonly<{
|
|
10
37
|
type: 'spring';
|
|
11
38
|
mass?: number;
|
|
12
39
|
stiffness?: number;
|
|
13
40
|
damping?: number;
|
|
14
41
|
initialVelocity?: number | 'inherit';
|
|
15
42
|
}>;
|
|
16
|
-
export type KeyframedClipAnimation = Readonly<{
|
|
43
|
+
export type KeyframedClipAnimation = ClipAnimationBase & Readonly<{
|
|
17
44
|
type: 'keyframes';
|
|
18
45
|
duration: number;
|
|
19
46
|
frames: readonly Readonly<{
|
|
@@ -41,6 +68,9 @@ export type SmoothClipUIControls = Readonly<{
|
|
|
41
68
|
* `beginInteraction()` remains the source of truth for visible geometry.
|
|
42
69
|
* Do not interleave with `presentation.value` writes on the same driver —
|
|
43
70
|
* the listener's duplicate suppression may skip a later equal value.
|
|
71
|
+
* To hand off into an animation from a fresher value than the last hot
|
|
72
|
+
* write, pass the geometry as `animation.from` to `animateTo` — it fuses
|
|
73
|
+
* this call and the handoff into one.
|
|
44
74
|
*/
|
|
45
75
|
setScalars(x: number, y: number, width: number, height: number, radius: number, contentTranslateX: number, contentTranslateY: number): void;
|
|
46
76
|
animateTo(presentation: SmoothClipPresentation, animation: SmoothClipAnimation): number;
|
|
@@ -58,4 +88,5 @@ export type SmoothClipDriver = Readonly<{
|
|
|
58
88
|
ui: SmoothClipUIControls;
|
|
59
89
|
react: SmoothClipReactControls;
|
|
60
90
|
}>;
|
|
91
|
+
export {};
|
|
61
92
|
//# sourceMappingURL=driverTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverTypes.d.ts","sourceRoot":"","sources":["../../../src/driverTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,O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AAS,CACP,YAAY,EAAE,sBAAsB,EACpC,SAAS,EAAE,mBAAmB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,MAAM,CACJ,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,QAAQ,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAClD,EAAE,EAAE,oBAAoB,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useSmoothClipDriver } from './drivers.
|
|
2
|
-
export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, } from './drivers.
|
|
1
|
+
export { useSmoothClipDriver } from './drivers.native.js';
|
|
2
|
+
export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, } from './drivers.native.js';
|
|
3
3
|
//# sourceMappingURL=drivers.android.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drivers.android.d.ts","sourceRoot":"","sources":["../../../src/drivers.android.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drivers.android.d.ts","sourceRoot":"","sources":["../../../src/drivers.android.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAkB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drivers.d.ts","sourceRoot":"","sources":["../../../src/drivers.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAYvB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"drivers.d.ts","sourceRoot":"","sources":["../../../src/drivers.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAYvB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;AA6FpB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,GAAG,sBAAsB,EACnD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CA+RlB;AAED,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function useSmoothClipDriver(initialValue: ClipGeometry | SmoothClipPresentation, options?: SmoothClipDriverOptions): SmoothClipDriver;
|
|
4
|
-
export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, };
|
|
1
|
+
export { useSmoothClipDriver } from './drivers.native.js';
|
|
2
|
+
export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, } from './drivers.native.js';
|
|
5
3
|
//# sourceMappingURL=drivers.ios.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drivers.ios.d.ts","sourceRoot":"","sources":["../../../src/drivers.ios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drivers.ios.d.ts","sourceRoot":"","sources":["../../../src/drivers.ios.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAkB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KeyframedClipAnimation, SmoothClipDriver, SmoothClipDriverOptions, SpringClipAnimation, TimingClipAnimation } from './driverTypes.js';
|
|
2
|
+
import { type ClipGeometry, type SmoothClipPresentation } from './geometry.js';
|
|
3
|
+
export declare function useSmoothClipDriver(initialValue: ClipGeometry | SmoothClipPresentation, options?: SmoothClipDriverOptions): SmoothClipDriver;
|
|
4
|
+
export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, };
|
|
5
|
+
//# sourceMappingURL=drivers.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drivers.native.d.ts","sourceRoot":"","sources":["../../../src/drivers.native.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAavB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;AAiJpB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,GAAG,sBAAsB,EACnD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CA2flB;AAED,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
|