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
package/src/easings.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact cubic-Bézier control points for the standard polynomial easings, for
|
|
3
|
+
* use as `TimingClipAnimation.controlPoints`.
|
|
4
|
+
*
|
|
5
|
+
* Native transitions and a parallel Reanimated animation (content driven by
|
|
6
|
+
* `withTiming` alongside a native `animateTo`) only stay in sync when both
|
|
7
|
+
* sides run the identical curve. Each entry below is the exact single-Bézier
|
|
8
|
+
* form of the matching Reanimated easing — not an approximation — so pairing
|
|
9
|
+
* e.g. `Easing.out(Easing.cubic)` with `ClipEasings.easeOutCubic` is
|
|
10
|
+
* mathematically lossless:
|
|
11
|
+
*
|
|
12
|
+
* - `linear` ↔ `Easing.linear`
|
|
13
|
+
* - `easeInQuad` ↔ `Easing.in(Easing.quad)`
|
|
14
|
+
* - `easeOutQuad` ↔ `Easing.out(Easing.quad)`
|
|
15
|
+
* - `easeInCubic` ↔ `Easing.in(Easing.cubic)`
|
|
16
|
+
* - `easeOutCubic` ↔ `Easing.out(Easing.cubic)`
|
|
17
|
+
*
|
|
18
|
+
* With x-control-points at 1/3 and 2/3 the Bézier's x(t) is the identity, so
|
|
19
|
+
* y(t) is the easing polynomial itself (e.g. `easeOutCubic`: y = 1 − (1−t)³).
|
|
20
|
+
*
|
|
21
|
+
* `Easing.inOut(Easing.cubic)` (and the other `inOut` polynomials) are
|
|
22
|
+
* piecewise and have NO exact single-Bézier form — for those, define one
|
|
23
|
+
* `Easing.bezier(x1, y1, x2, y2)` and pass the same four numbers as
|
|
24
|
+
* `controlPoints` so both sides share the same (approximated) curve.
|
|
25
|
+
*/
|
|
26
|
+
export const ClipEasings = {
|
|
27
|
+
linear: [0, 0, 1, 1],
|
|
28
|
+
easeInQuad: [1 / 3, 0, 2 / 3, 1 / 3],
|
|
29
|
+
easeOutQuad: [1 / 3, 2 / 3, 2 / 3, 1],
|
|
30
|
+
easeInCubic: [1 / 3, 0, 2 / 3, 0],
|
|
31
|
+
easeOutCubic: [1 / 3, 1, 2 / 3, 1],
|
|
32
|
+
} as const satisfies Record<string, readonly [number, number, number, number]>;
|
package/src/index.ts
CHANGED
package/src/index.web.ts
CHANGED