@wandelbots/wandelbots-js-react-components 2.27.1 → 2.28.0
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 +1 -1
- package/dist/Setup.d.ts +1 -1
- package/dist/Setup.d.ts.map +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +2 -2
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/TrajectoryRenderer.d.ts +1 -1
- package/dist/components/3d-viewport/TrajectoryRenderer.d.ts.map +1 -1
- package/dist/components/robots/DHRobot.d.ts.map +1 -1
- package/dist/components/robots/GenericRobot.d.ts +2 -2
- package/dist/components/robots/GenericRobot.d.ts.map +1 -1
- package/dist/components/robots/Robot.d.ts +2 -2
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.test.d.ts +2 -0
- package/dist/components/robots/RobotAnimator.test.d.ts.map +1 -0
- package/dist/components/robots/SupportedRobot.d.ts +3 -3
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/utils/interpolation.d.ts +159 -0
- package/dist/components/utils/interpolation.d.ts.map +1 -0
- package/dist/components/utils/interpolation.test.d.ts +2 -0
- package/dist/components/utils/interpolation.test.d.ts.map +1 -0
- package/dist/externalizeComponent.d.ts +1 -1
- package/dist/externalizeComponent.d.ts.map +1 -1
- package/dist/index.cjs +39 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8251 -9820
- package/dist/index.js.map +1 -1
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/package.json +33 -32
- package/src/Setup.tsx +1 -1
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -2
- package/src/components/3d-viewport/TrajectoryRenderer.tsx +1 -1
- package/src/components/jogging/JoggingOptions.tsx +1 -1
- package/src/components/robots/DHRobot.tsx +37 -10
- package/src/components/robots/GenericRobot.tsx +4 -5
- package/src/components/robots/Robot.tsx +2 -2
- package/src/components/robots/RobotAnimator.test.tsx +113 -0
- package/src/components/robots/RobotAnimator.tsx +38 -23
- package/src/components/robots/SupportedRobot.tsx +3 -3
- package/src/components/utils/converters.ts +1 -1
- package/src/components/utils/interpolation.test.ts +1123 -0
- package/src/components/utils/interpolation.ts +379 -0
- package/src/externalizeComponent.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/test/setup.ts +111 -0
package/README.md
CHANGED
package/dist/Setup.d.ts
CHANGED
package/dist/Setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Setup.d.ts","sourceRoot":"","sources":["../src/Setup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,
|
|
1
|
+
{"version":3,"file":"Setup.d.ts","sourceRoot":"","sources":["../src/Setup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG/B,KAAK,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAClC,WAAW,GAAG;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CACF,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,yEAOnB,KAAK,4CAcP,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ThreeElements } from "@react-three/fiber";
|
|
2
2
|
import type { SafetySetupSafetyZone } from "@wandelbots/nova-js/v1";
|
|
3
3
|
export type SafetyZonesRendererProps = {
|
|
4
4
|
safetyZones: SafetySetupSafetyZone[];
|
|
5
|
-
} &
|
|
5
|
+
} & ThreeElements["group"];
|
|
6
6
|
export declare function SafetyZonesRenderer({ safetyZones, ...props }: SafetyZonesRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=SafetyZonesRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafetyZonesRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/3d-viewport/SafetyZonesRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"SafetyZonesRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/3d-viewport/SafetyZonesRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAInE,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,qBAAqB,EAAE,CAAA;CACrC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;AAqC1B,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,GAAG,KAAK,EACT,EAAE,wBAAwB,2CA6D1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GetTrajectoryResponse } from "@wandelbots/nova-js/v1";
|
|
2
2
|
export type TrajectoryRendererProps = {
|
|
3
3
|
trajectory: GetTrajectoryResponse;
|
|
4
|
-
} & JSX.IntrinsicElements["group"];
|
|
4
|
+
} & React.JSX.IntrinsicElements["group"];
|
|
5
5
|
export declare function TrajectoryRenderer({ trajectory, ...props }: TrajectoryRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=TrajectoryRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrajectoryRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/3d-viewport/TrajectoryRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAGnE,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,qBAAqB,CAAA;CAClC,GAAG,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"TrajectoryRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/3d-viewport/TrajectoryRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAGnE,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,qBAAqB,CAAA;CAClC,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAExC,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,GAAG,KAAK,EACT,EAAE,uBAAuB,2CA4BzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DHRobot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/DHRobot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DHRobot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/DHRobot.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAKpD,wBAAgB,OAAO,CAAC,EACtB,0BAA0B,EAC1B,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,YAAY,2CAoId"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThreeElements } from "@react-three/fiber";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { Group } from "three";
|
|
4
4
|
export type RobotModelProps = {
|
|
@@ -9,6 +9,6 @@ export type RobotModelProps = {
|
|
|
9
9
|
*/
|
|
10
10
|
postModelRender?: () => void;
|
|
11
11
|
flangeRef?: React.Ref<Group>;
|
|
12
|
-
} &
|
|
12
|
+
} & ThreeElements["group"];
|
|
13
13
|
export declare function GenericRobot({ modelURL, flangeRef, postModelRender, ...props }: RobotModelProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
//# sourceMappingURL=GenericRobot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericRobot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/GenericRobot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenericRobot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/GenericRobot.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAsB,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAQ,MAAM,OAAO,CAAA;AAIxC,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;CAC7B,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;AAM1B,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,eAAe,EACf,GAAG,KAAK,EACT,EAAE,eAAe,2CA+CjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ThreeElements } from "@react-three/fiber";
|
|
2
2
|
import type { ConnectedMotionGroup } from "@wandelbots/nova-js/v1";
|
|
3
3
|
import type { Group } from "three";
|
|
4
4
|
export type RobotProps = {
|
|
@@ -6,7 +6,7 @@ export type RobotProps = {
|
|
|
6
6
|
getModel?: (modelFromController: string) => string;
|
|
7
7
|
flangeRef?: React.Ref<Group>;
|
|
8
8
|
transparentColor?: string;
|
|
9
|
-
} &
|
|
9
|
+
} & ThreeElements["group"];
|
|
10
10
|
/**
|
|
11
11
|
* The Robot component is a wrapper around the SupportedRobot component
|
|
12
12
|
* for usage with @wandelbots/nova-js ConnectedMotionGroup object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Robot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/Robot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"Robot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/Robot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAIlC,MAAM,MAAM,UAAU,GAAG;IACvB,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,QAAQ,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK,MAAM,CAAA;IAClD,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;AAE1B;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,EACpB,oBAAoB,EACpB,QAA0B,EAC1B,SAAS,EACT,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,UAAU,kDAkBZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RobotAnimator.d.ts","sourceRoot":"","sources":["../../../src/components/robots/RobotAnimator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RobotAnimator.d.ts","sourceRoot":"","sources":["../../../src/components/robots/RobotAnimator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,OAAO,CAAA;AAK5C,KAAK,kBAAkB,GAAG;IACxB,0BAA0B,EAAE,wBAAwB,CAAA;IACpD,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACvE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,0BAA0B,EAC1B,YAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,EAAE,kBAAkB,2CA+EpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RobotAnimator.test.d.ts","sourceRoot":"","sources":["../../../src/components/robots/RobotAnimator.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThreeElements } from "@react-three/fiber";
|
|
2
2
|
import type { DHParameter, MotionGroupStateResponse } from "@wandelbots/nova-api/v1";
|
|
3
3
|
import type * as THREE from "three";
|
|
4
4
|
export type DHRobotProps = {
|
|
5
5
|
rapidlyChangingMotionState: MotionGroupStateResponse;
|
|
6
6
|
dhParameters: Array<DHParameter>;
|
|
7
|
-
} &
|
|
7
|
+
} & ThreeElements["group"];
|
|
8
8
|
export type SupportedRobotProps = {
|
|
9
9
|
rapidlyChangingMotionState: MotionGroupStateResponse;
|
|
10
10
|
modelFromController: string;
|
|
@@ -13,6 +13,6 @@ export type SupportedRobotProps = {
|
|
|
13
13
|
getModel?: (modelFromController: string) => string;
|
|
14
14
|
postModelRender?: () => void;
|
|
15
15
|
transparentColor?: string;
|
|
16
|
-
} &
|
|
16
|
+
} & ThreeElements["group"];
|
|
17
17
|
export declare const SupportedRobot: ({ rapidlyChangingMotionState, modelFromController, dhParameters, getModel, flangeRef, postModelRender, transparentColor, ...props }: SupportedRobotProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
//# sourceMappingURL=SupportedRobot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedRobot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/SupportedRobot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SupportedRobot.d.ts","sourceRoot":"","sources":["../../../src/components/robots/SupportedRobot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACzB,MAAM,yBAAyB,CAAA;AAKhC,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAQnC,MAAM,MAAM,YAAY,GAAG;IACzB,0BAA0B,EAAE,wBAAwB,CAAA;IACpD,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;CACjC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;AAE1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,0BAA0B,EAAE,wBAAwB,CAAA;IACpD,mBAAmB,EAAE,MAAM,CAAA;IAC3B,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK,MAAM,CAAA;IAClD,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;AAE1B,eAAO,MAAM,cAAc,wIAUtB,mBAAmB,4CAoDvB,CAAA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smooth value interpolation utility using spring physics with tension and friction.
|
|
3
|
+
* Designed for React Three Fiber applications with smooth, natural animations.
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Spring physics with configurable tension and friction
|
|
7
|
+
* - Frame-rate independent using delta timing
|
|
8
|
+
* - Handles irregular frame timing and rapid target updates
|
|
9
|
+
* - Manual update() calls for useFrame integration (no automatic RAF loop)
|
|
10
|
+
* - Direct mutation for performance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Basic spring animation
|
|
15
|
+
* const interpolator = new ValueInterpolator([0, 0, 0], {
|
|
16
|
+
* tension: 120, // Higher = faster, stiffer spring (default: 120)
|
|
17
|
+
* friction: 20, // Higher = more damping, less oscillation (default: 20)
|
|
18
|
+
* onChange: (values) => {
|
|
19
|
+
* robot.joints.forEach((joint, i) => {
|
|
20
|
+
* joint.rotation.y = values[i]
|
|
21
|
+
* })
|
|
22
|
+
* }
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* interpolator.setTarget([1.5, -0.8, 2.1])
|
|
26
|
+
*
|
|
27
|
+
* // React Three Fiber usage
|
|
28
|
+
* function MyComponent() {
|
|
29
|
+
* const [interpolator] = useInterpolation([0, 0, 0])
|
|
30
|
+
*
|
|
31
|
+
* useFrame((state, delta) => {
|
|
32
|
+
* interpolator.update(delta)
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* useEffect(() => {
|
|
36
|
+
* interpolator.setTarget([1, 2, 3])
|
|
37
|
+
* }, [])
|
|
38
|
+
*
|
|
39
|
+
* return <mesh position={interpolator.getCurrentValues()} />
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export interface InterpolationOptions {
|
|
44
|
+
/** Spring tension (higher = faster, stiffer spring) - default: 120 */
|
|
45
|
+
tension?: number;
|
|
46
|
+
/** Spring friction (higher = more damping, less oscillation) - default: 20 */
|
|
47
|
+
friction?: number;
|
|
48
|
+
/** Minimum threshold to consider interpolation complete - default: 0.001 */
|
|
49
|
+
threshold?: number;
|
|
50
|
+
/** Callback when values change during interpolation */
|
|
51
|
+
onChange?: (values: number[]) => void;
|
|
52
|
+
/** Callback when interpolation reaches target values */
|
|
53
|
+
onComplete?: (values: number[]) => void;
|
|
54
|
+
}
|
|
55
|
+
export declare class ValueInterpolator {
|
|
56
|
+
private currentValues;
|
|
57
|
+
private targetValues;
|
|
58
|
+
private previousTargetValues;
|
|
59
|
+
private targetUpdateTime;
|
|
60
|
+
private animationId;
|
|
61
|
+
private options;
|
|
62
|
+
private updateCount;
|
|
63
|
+
private velocities;
|
|
64
|
+
constructor(initialValues?: number[], options?: InterpolationOptions);
|
|
65
|
+
/**
|
|
66
|
+
* Update interpolation using spring physics
|
|
67
|
+
*
|
|
68
|
+
* Call this method every frame for smooth animation. In React Three Fiber,
|
|
69
|
+
* call from within useFrame callback with the provided delta time.
|
|
70
|
+
*
|
|
71
|
+
* @param delta - Time elapsed since last update in seconds (e.g., 1/60 ≈ 0.0167 for 60fps)
|
|
72
|
+
* @returns true when interpolation is complete (all values reached their targets)
|
|
73
|
+
*/
|
|
74
|
+
update(delta?: number): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Set new target values for the interpolation to move towards
|
|
77
|
+
*
|
|
78
|
+
* Includes smart blending for very rapid target updates (faster than 120fps)
|
|
79
|
+
* to prevent jarring movements when targets change frequently.
|
|
80
|
+
*/
|
|
81
|
+
setTarget(newValues: number[]): void;
|
|
82
|
+
/**
|
|
83
|
+
* Get a copy of all current interpolated values
|
|
84
|
+
*/
|
|
85
|
+
getCurrentValues(): number[];
|
|
86
|
+
/**
|
|
87
|
+
* Get a single interpolated value by its array index
|
|
88
|
+
*/
|
|
89
|
+
getValue(index: number): number;
|
|
90
|
+
/**
|
|
91
|
+
* Check if automatic interpolation is currently running
|
|
92
|
+
*
|
|
93
|
+
* This only tracks auto-interpolation started with startAutoInterpolation().
|
|
94
|
+
* Manual update() calls are not tracked by this method.
|
|
95
|
+
*/
|
|
96
|
+
isInterpolating(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Stop automatic interpolation if it's running
|
|
99
|
+
*
|
|
100
|
+
* This cancels the internal animation frame loop but does not affect
|
|
101
|
+
* manual update() calls.
|
|
102
|
+
*/
|
|
103
|
+
stop(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Instantly set values without interpolation
|
|
106
|
+
*/
|
|
107
|
+
setImmediate(values: number[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* Update interpolation options
|
|
110
|
+
*/
|
|
111
|
+
updateOptions(newOptions: Partial<InterpolationOptions>): void;
|
|
112
|
+
/**
|
|
113
|
+
* Start automatic interpolation with an animation loop
|
|
114
|
+
*
|
|
115
|
+
* This begins a requestAnimationFrame loop that calls update() automatically.
|
|
116
|
+
* For React Three Fiber components, prefer using manual update() calls
|
|
117
|
+
* within useFrame hooks instead.
|
|
118
|
+
*/
|
|
119
|
+
startAutoInterpolation(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Clean up all resources and stop any running animations
|
|
122
|
+
*
|
|
123
|
+
* This cancels any active animation frames and resets internal state.
|
|
124
|
+
* Call this when the component unmounts or is no longer needed.
|
|
125
|
+
*/
|
|
126
|
+
destroy(): void;
|
|
127
|
+
private startInterpolation;
|
|
128
|
+
private animate;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* React hook for using the ValueInterpolator with useFrame
|
|
132
|
+
*
|
|
133
|
+
* This hook creates a ValueInterpolator that uses spring physics for smooth,
|
|
134
|
+
* natural animations. Call interpolator.update(delta) in your useFrame callback.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```tsx
|
|
138
|
+
* function AnimatedMesh() {
|
|
139
|
+
* const [interpolator] = useInterpolation([0, 0, 0], {
|
|
140
|
+
* tension: 120, // Higher = faster spring
|
|
141
|
+
* friction: 20 // Higher = more damping
|
|
142
|
+
* })
|
|
143
|
+
* const meshRef = useRef()
|
|
144
|
+
*
|
|
145
|
+
* useFrame((state, delta) => {
|
|
146
|
+
* if (interpolator.update(delta)) {
|
|
147
|
+
* // Animation complete
|
|
148
|
+
* }
|
|
149
|
+
* // Apply current values directly to mesh
|
|
150
|
+
* const [x, y, z] = interpolator.getCurrentValues()
|
|
151
|
+
* meshRef.current.position.set(x, y, z)
|
|
152
|
+
* })
|
|
153
|
+
*
|
|
154
|
+
* return <mesh ref={meshRef} />
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export declare function useInterpolation(initialValues?: number[], options?: InterpolationOptions): [ValueInterpolator];
|
|
159
|
+
//# sourceMappingURL=interpolation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../../../src/components/utils/interpolation.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACrC,wDAAwD;IACxD,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACxC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,oBAAoB,CAAe;IAC3C,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,WAAW,CAAY;IAG/B,OAAO,CAAC,UAAU,CAAe;gBAG/B,aAAa,GAAE,MAAM,EAAO,EAC5B,OAAO,GAAE,oBAAyB;IAmBpC;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,GAAE,MAAe,GAAG,OAAO;IAmEvC;;;;;OAKG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAsDpC;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI/B;;;;;OAKG;IACH,eAAe,IAAI,OAAO;IAI1B;;;;;OAKG;IACH,IAAI,IAAI,IAAI;IAOZ;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;IAWpC;;OAEG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;IAI9D;;;;;;OAMG;IACH,sBAAsB,IAAI,IAAI;IAI9B;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,OAAO,CASd;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,GAAE,MAAM,EAAO,EAC5B,OAAO,GAAE,oBAAyB,GACjC,CAAC,iBAAiB,CAAC,CAqBrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.test.d.ts","sourceRoot":"","sources":["../../../src/components/utils/interpolation.test.ts"],"names":[],"mappings":""}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* be provided by the user application; this wrapper ensures
|
|
4
4
|
* they can be used either way.
|
|
5
5
|
*/
|
|
6
|
-
export declare function externalizeComponent<T extends JSX.ElementType>(Component: T): T;
|
|
6
|
+
export declare function externalizeComponent<T extends React.JSX.ElementType>(Component: T): T;
|
|
7
7
|
//# sourceMappingURL=externalizeComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalizeComponent.d.ts","sourceRoot":"","sources":["../src/externalizeComponent.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,GAAG,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"externalizeComponent.d.ts","sourceRoot":"","sources":["../src/externalizeComponent.tsx"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,WAAW,EAClE,SAAS,EAAE,CAAC,GACX,CAAC,CAQH"}
|