@shopify/react-native-skia 0.1.182 → 0.1.183
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/lib/commonjs/animation/functions/interpolate.js +10 -1
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolateColors.js +6 -0
- package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolatePaths.js +4 -0
- package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolateVector.js +13 -5
- package/lib/commonjs/animation/functions/interpolateVector.js.map +1 -1
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js +5 -2
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Coordinates.js +42 -18
- package/lib/commonjs/renderer/processors/math/Coordinates.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Math.js +10 -2
- package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Transforms.js +2 -0
- package/lib/commonjs/renderer/processors/math/Transforms.js.map +1 -1
- package/lib/commonjs/renderer/typeddash.js +2 -0
- package/lib/commonjs/renderer/typeddash.js.map +1 -1
- package/lib/commonjs/skia/core/Vector.js +24 -4
- package/lib/commonjs/skia/core/Vector.js.map +1 -1
- package/lib/module/animation/functions/interpolate.js +10 -1
- package/lib/module/animation/functions/interpolate.js.map +1 -1
- package/lib/module/animation/functions/interpolateColors.js +6 -0
- package/lib/module/animation/functions/interpolateColors.js.map +1 -1
- package/lib/module/animation/functions/interpolatePaths.js +4 -0
- package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/module/animation/functions/interpolateVector.js +13 -5
- package/lib/module/animation/functions/interpolateVector.js.map +1 -1
- package/lib/module/external/reanimated/useSharedValueEffect.js +6 -3
- package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/module/renderer/processors/math/Coordinates.js +42 -18
- package/lib/module/renderer/processors/math/Coordinates.js.map +1 -1
- package/lib/module/renderer/processors/math/Math.js +10 -2
- package/lib/module/renderer/processors/math/Math.js.map +1 -1
- package/lib/module/renderer/processors/math/Transforms.js +2 -0
- package/lib/module/renderer/processors/math/Transforms.js.map +1 -1
- package/lib/module/renderer/typeddash.js +2 -0
- package/lib/module/renderer/typeddash.js.map +1 -1
- package/lib/module/skia/core/Vector.js +24 -4
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/package.json +1 -1
- package/react-native-skia.podspec +2 -6
- package/src/animation/functions/interpolate.ts +5 -0
- package/src/animation/functions/interpolateColors.ts +3 -0
- package/src/animation/functions/interpolatePaths.ts +2 -0
- package/src/animation/functions/interpolateVector.ts +21 -16
- package/src/external/reanimated/useSharedValueEffect.ts +7 -4
- package/src/renderer/processors/math/Coordinates.ts +36 -20
- package/src/renderer/processors/math/Math.ts +12 -4
- package/src/renderer/processors/math/Transforms.ts +1 -0
- package/src/renderer/typeddash.ts +1 -0
- package/src/skia/core/Vector.ts +24 -7
package/src/skia/core/Vector.ts
CHANGED
@@ -1,11 +1,28 @@
|
|
1
1
|
import { Skia } from "../Skia";
|
2
2
|
import type { Vector } from "../types";
|
3
3
|
|
4
|
-
export const vec = (x = 0, y?: number) =>
|
4
|
+
export const vec = (x = 0, y?: number) => {
|
5
|
+
"worklet";
|
6
|
+
return Skia.Point(x, y ?? x);
|
7
|
+
};
|
5
8
|
export const point = vec;
|
6
|
-
export const neg = (a: Vector) =>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
export const
|
11
|
-
|
9
|
+
export const neg = (a: Vector) => {
|
10
|
+
"worklet";
|
11
|
+
return vec(-a.x, -a.y);
|
12
|
+
};
|
13
|
+
export const add = (a: Vector, b: Vector) => {
|
14
|
+
"worklet";
|
15
|
+
return vec(a.x + b.x, a.y + b.y);
|
16
|
+
};
|
17
|
+
export const sub = (a: Vector, b: Vector) => {
|
18
|
+
"worklet";
|
19
|
+
return vec(a.x - b.x, a.y - b.y);
|
20
|
+
};
|
21
|
+
export const dist = (a: Vector, b: Vector) => {
|
22
|
+
"worklet";
|
23
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
24
|
+
};
|
25
|
+
export const translate = ({ x, y }: Vector) => {
|
26
|
+
"worklet";
|
27
|
+
return [{ translateX: x }, { translateY: y }] as const;
|
28
|
+
};
|