@codellyson/framely 0.1.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/dist/AbsoluteFill.d.ts +18 -0
- package/dist/AbsoluteFill.d.ts.map +1 -0
- package/dist/AbsoluteFill.js +25 -0
- package/dist/AbsoluteFill.js.map +1 -0
- package/dist/Audio.d.ts +80 -0
- package/dist/Audio.d.ts.map +1 -0
- package/dist/Audio.js +221 -0
- package/dist/Audio.js.map +1 -0
- package/dist/Composition.d.ts +208 -0
- package/dist/Composition.d.ts.map +1 -0
- package/dist/Composition.js +210 -0
- package/dist/Composition.js.map +1 -0
- package/dist/Easing.d.ts +88 -0
- package/dist/Easing.d.ts.map +1 -0
- package/dist/Easing.js +266 -0
- package/dist/Easing.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +35 -0
- package/dist/ErrorBoundary.d.ts.map +1 -0
- package/dist/ErrorBoundary.js +74 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/Folder.d.ts +46 -0
- package/dist/Folder.d.ts.map +1 -0
- package/dist/Folder.js +44 -0
- package/dist/Folder.js.map +1 -0
- package/dist/Freeze.d.ts +35 -0
- package/dist/Freeze.d.ts.map +1 -0
- package/dist/Freeze.js +40 -0
- package/dist/Freeze.js.map +1 -0
- package/dist/IFrame.d.ts +28 -0
- package/dist/IFrame.d.ts.map +1 -0
- package/dist/IFrame.js +57 -0
- package/dist/IFrame.js.map +1 -0
- package/dist/Img.d.ts +36 -0
- package/dist/Img.d.ts.map +1 -0
- package/dist/Img.js +91 -0
- package/dist/Img.js.map +1 -0
- package/dist/Loop.d.ts +66 -0
- package/dist/Loop.d.ts.map +1 -0
- package/dist/Loop.js +79 -0
- package/dist/Loop.js.map +1 -0
- package/dist/Player.d.ts +118 -0
- package/dist/Player.d.ts.map +1 -0
- package/dist/Player.js +311 -0
- package/dist/Player.js.map +1 -0
- package/dist/Sequence.d.ts +25 -0
- package/dist/Sequence.d.ts.map +1 -0
- package/dist/Sequence.js +37 -0
- package/dist/Sequence.js.map +1 -0
- package/dist/Series.d.ts +52 -0
- package/dist/Series.d.ts.map +1 -0
- package/dist/Series.js +86 -0
- package/dist/Series.js.map +1 -0
- package/dist/Text.d.ts +129 -0
- package/dist/Text.d.ts.map +1 -0
- package/dist/Text.js +211 -0
- package/dist/Text.js.map +1 -0
- package/dist/Video.d.ts +75 -0
- package/dist/Video.d.ts.map +1 -0
- package/dist/Video.js +136 -0
- package/dist/Video.js.map +1 -0
- package/dist/config.d.ts +128 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +243 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +84 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +131 -0
- package/dist/context.js.map +1 -0
- package/dist/delayRender.d.ts +130 -0
- package/dist/delayRender.d.ts.map +1 -0
- package/dist/delayRender.js +197 -0
- package/dist/delayRender.js.map +1 -0
- package/dist/getInputProps.d.ts +118 -0
- package/dist/getInputProps.d.ts.map +1 -0
- package/dist/getInputProps.js +181 -0
- package/dist/getInputProps.js.map +1 -0
- package/dist/hooks/useDelayRender.d.ts +52 -0
- package/dist/hooks/useDelayRender.d.ts.map +1 -0
- package/dist/hooks/useDelayRender.js +92 -0
- package/dist/hooks/useDelayRender.js.map +1 -0
- package/dist/hooks.d.ts +19 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +17 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/interpolate.d.ts +80 -0
- package/dist/interpolate.d.ts.map +1 -0
- package/dist/interpolate.js +108 -0
- package/dist/interpolate.js.map +1 -0
- package/dist/interpolateColors.d.ts +50 -0
- package/dist/interpolateColors.d.ts.map +1 -0
- package/dist/interpolateColors.js +300 -0
- package/dist/interpolateColors.js.map +1 -0
- package/dist/makeTransform.d.ts +98 -0
- package/dist/makeTransform.d.ts.map +1 -0
- package/dist/makeTransform.js +287 -0
- package/dist/makeTransform.js.map +1 -0
- package/dist/measureSpring.d.ts +75 -0
- package/dist/measureSpring.d.ts.map +1 -0
- package/dist/measureSpring.js +108 -0
- package/dist/measureSpring.js.map +1 -0
- package/dist/noise.d.ts +110 -0
- package/dist/noise.d.ts.map +1 -0
- package/dist/noise.js +228 -0
- package/dist/noise.js.map +1 -0
- package/dist/preload.d.ts +145 -0
- package/dist/preload.d.ts.map +1 -0
- package/dist/preload.js +225 -0
- package/dist/preload.js.map +1 -0
- package/dist/registerRoot.d.ts +140 -0
- package/dist/registerRoot.d.ts.map +1 -0
- package/dist/registerRoot.js +238 -0
- package/dist/registerRoot.js.map +1 -0
- package/dist/shapes/Circle.d.ts +15 -0
- package/dist/shapes/Circle.d.ts.map +1 -0
- package/dist/shapes/Circle.js +11 -0
- package/dist/shapes/Circle.js.map +1 -0
- package/dist/shapes/Ellipse.d.ts +16 -0
- package/dist/shapes/Ellipse.d.ts.map +1 -0
- package/dist/shapes/Ellipse.js +11 -0
- package/dist/shapes/Ellipse.js.map +1 -0
- package/dist/shapes/Line.d.ts +15 -0
- package/dist/shapes/Line.d.ts.map +1 -0
- package/dist/shapes/Line.js +11 -0
- package/dist/shapes/Line.js.map +1 -0
- package/dist/shapes/Path.d.ts +20 -0
- package/dist/shapes/Path.d.ts.map +1 -0
- package/dist/shapes/Path.js +14 -0
- package/dist/shapes/Path.js.map +1 -0
- package/dist/shapes/Polygon.d.ts +15 -0
- package/dist/shapes/Polygon.d.ts.map +1 -0
- package/dist/shapes/Polygon.js +16 -0
- package/dist/shapes/Polygon.js.map +1 -0
- package/dist/shapes/Rect.d.ts +18 -0
- package/dist/shapes/Rect.d.ts.map +1 -0
- package/dist/shapes/Rect.js +11 -0
- package/dist/shapes/Rect.js.map +1 -0
- package/dist/shapes/Svg.d.ts +16 -0
- package/dist/shapes/Svg.d.ts.map +1 -0
- package/dist/shapes/Svg.js +15 -0
- package/dist/shapes/Svg.js.map +1 -0
- package/dist/shapes/index.d.ts +16 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +9 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/usePathLength.d.ts +24 -0
- package/dist/shapes/usePathLength.d.ts.map +1 -0
- package/dist/shapes/usePathLength.js +32 -0
- package/dist/shapes/usePathLength.js.map +1 -0
- package/dist/staticFile.d.ts +47 -0
- package/dist/staticFile.d.ts.map +1 -0
- package/dist/staticFile.js +105 -0
- package/dist/staticFile.js.map +1 -0
- package/dist/templates/api.d.ts +26 -0
- package/dist/templates/api.d.ts.map +1 -0
- package/dist/templates/api.js +142 -0
- package/dist/templates/api.js.map +1 -0
- package/dist/templates/index.d.ts +7 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +7 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/mockData.d.ts +7 -0
- package/dist/templates/mockData.d.ts.map +1 -0
- package/dist/templates/mockData.js +262 -0
- package/dist/templates/mockData.js.map +1 -0
- package/dist/templates/types.d.ts +104 -0
- package/dist/templates/types.d.ts.map +1 -0
- package/dist/templates/types.js +16 -0
- package/dist/templates/types.js.map +1 -0
- package/dist/transitions/TransitionSeries.d.ts +127 -0
- package/dist/transitions/TransitionSeries.d.ts.map +1 -0
- package/dist/transitions/TransitionSeries.js +190 -0
- package/dist/transitions/TransitionSeries.js.map +1 -0
- package/dist/transitions/index.d.ts +52 -0
- package/dist/transitions/index.d.ts.map +1 -0
- package/dist/transitions/index.js +31 -0
- package/dist/transitions/index.js.map +1 -0
- package/dist/transitions/presets/fade.d.ts +45 -0
- package/dist/transitions/presets/fade.d.ts.map +1 -0
- package/dist/transitions/presets/fade.js +56 -0
- package/dist/transitions/presets/fade.js.map +1 -0
- package/dist/transitions/presets/flip.d.ts +99 -0
- package/dist/transitions/presets/flip.d.ts.map +1 -0
- package/dist/transitions/presets/flip.js +153 -0
- package/dist/transitions/presets/flip.js.map +1 -0
- package/dist/transitions/presets/slide.d.ts +61 -0
- package/dist/transitions/presets/slide.d.ts.map +1 -0
- package/dist/transitions/presets/slide.js +116 -0
- package/dist/transitions/presets/slide.js.map +1 -0
- package/dist/transitions/presets/wipe.d.ts +69 -0
- package/dist/transitions/presets/wipe.d.ts.map +1 -0
- package/dist/transitions/presets/wipe.js +136 -0
- package/dist/transitions/presets/wipe.js.map +1 -0
- package/dist/transitions/presets/zoom.d.ts +76 -0
- package/dist/transitions/presets/zoom.d.ts.map +1 -0
- package/dist/transitions/presets/zoom.js +110 -0
- package/dist/transitions/presets/zoom.js.map +1 -0
- package/dist/useAudioData.d.ts +112 -0
- package/dist/useAudioData.d.ts.map +1 -0
- package/dist/useAudioData.js +183 -0
- package/dist/useAudioData.js.map +1 -0
- package/dist/useSpring.d.ts +79 -0
- package/dist/useSpring.d.ts.map +1 -0
- package/dist/useSpring.js +140 -0
- package/dist/useSpring.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DelayRenderOptions } from '../delayRender';
|
|
2
|
+
/**
|
|
3
|
+
* Return type for the useDelayRender hook.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseDelayRenderReturn {
|
|
6
|
+
/** Call this to signal that the async operation has completed. */
|
|
7
|
+
continueRender: () => void;
|
|
8
|
+
/** Whether the hook is still waiting (continueRender has not been called yet). */
|
|
9
|
+
isWaiting: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Hook for managing delay render in React components.
|
|
13
|
+
*
|
|
14
|
+
* Automatically handles cleanup on unmount and provides a cleaner API
|
|
15
|
+
* than using delayRender/continueRender directly.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} [label] - Label for debugging timeout errors
|
|
18
|
+
* @param {object} [options]
|
|
19
|
+
* @param {number} [options.timeoutInMilliseconds=30000] - Timeout before throwing
|
|
20
|
+
* @param {number} [options.retries=0] - Number of retries on timeout
|
|
21
|
+
* @returns {{ continueRender: () => void, isWaiting: boolean }}
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* function MyComponent() {
|
|
25
|
+
* const [data, setData] = useState(null);
|
|
26
|
+
* const { continueRender } = useDelayRender('Loading data');
|
|
27
|
+
*
|
|
28
|
+
* useEffect(() => {
|
|
29
|
+
* fetchData().then(d => {
|
|
30
|
+
* setData(d);
|
|
31
|
+
* continueRender();
|
|
32
|
+
* });
|
|
33
|
+
* }, [continueRender]);
|
|
34
|
+
*
|
|
35
|
+
* return data ? <div>{data}</div> : null;
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
38
|
+
export declare function useDelayRender(label?: string | DelayRenderOptions, options?: DelayRenderOptions): UseDelayRenderReturn;
|
|
39
|
+
/**
|
|
40
|
+
* Hook that delays render while a condition is true.
|
|
41
|
+
*
|
|
42
|
+
* @param {boolean} condition - If true, delays render
|
|
43
|
+
* @param {string} [label] - Label for debugging
|
|
44
|
+
* @param {object} [options] - Same options as useDelayRender
|
|
45
|
+
*
|
|
46
|
+
* Usage:
|
|
47
|
+
* const [isLoading, setIsLoading] = useState(true);
|
|
48
|
+
* useDelayRenderWhile(isLoading, 'Waiting for data');
|
|
49
|
+
*/
|
|
50
|
+
export declare function useDelayRenderWhile(condition: boolean, label?: string, options?: DelayRenderOptions): void;
|
|
51
|
+
export default useDelayRender;
|
|
52
|
+
//# sourceMappingURL=useDelayRender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDelayRender.d.ts","sourceRoot":"","sources":["../../src/hooks/useDelayRender.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,kFAAkF;IAClF,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,kBAAkB,EACnC,OAAO,GAAE,kBAAuB,GAC/B,oBAAoB,CAiCtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,OAAO,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,IAAI,CAqBN;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useEffect, useRef, useCallback } from 'react';
|
|
2
|
+
import { delayRender, continueRender } from '../delayRender';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for managing delay render in React components.
|
|
5
|
+
*
|
|
6
|
+
* Automatically handles cleanup on unmount and provides a cleaner API
|
|
7
|
+
* than using delayRender/continueRender directly.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} [label] - Label for debugging timeout errors
|
|
10
|
+
* @param {object} [options]
|
|
11
|
+
* @param {number} [options.timeoutInMilliseconds=30000] - Timeout before throwing
|
|
12
|
+
* @param {number} [options.retries=0] - Number of retries on timeout
|
|
13
|
+
* @returns {{ continueRender: () => void, isWaiting: boolean }}
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* function MyComponent() {
|
|
17
|
+
* const [data, setData] = useState(null);
|
|
18
|
+
* const { continueRender } = useDelayRender('Loading data');
|
|
19
|
+
*
|
|
20
|
+
* useEffect(() => {
|
|
21
|
+
* fetchData().then(d => {
|
|
22
|
+
* setData(d);
|
|
23
|
+
* continueRender();
|
|
24
|
+
* });
|
|
25
|
+
* }, [continueRender]);
|
|
26
|
+
*
|
|
27
|
+
* return data ? <div>{data}</div> : null;
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
export function useDelayRender(label, options = {}) {
|
|
31
|
+
const handleRef = useRef(null);
|
|
32
|
+
const continuedRef = useRef(false);
|
|
33
|
+
// Create the handle on mount
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const actualLabel = typeof label === 'string' ? label : 'useDelayRender';
|
|
36
|
+
const actualOptions = typeof label === 'object' ? label : options;
|
|
37
|
+
handleRef.current = delayRender(actualLabel, actualOptions);
|
|
38
|
+
continuedRef.current = false;
|
|
39
|
+
// Cleanup on unmount - continue if not already done
|
|
40
|
+
return () => {
|
|
41
|
+
if (handleRef.current !== null && !continuedRef.current) {
|
|
42
|
+
continueRender(handleRef.current);
|
|
43
|
+
continuedRef.current = true;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, []); // Only run on mount/unmount
|
|
47
|
+
// Stable callback to continue rendering
|
|
48
|
+
const continueRenderCallback = useCallback(() => {
|
|
49
|
+
if (handleRef.current !== null && !continuedRef.current) {
|
|
50
|
+
continueRender(handleRef.current);
|
|
51
|
+
continuedRef.current = true;
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
return {
|
|
55
|
+
continueRender: continueRenderCallback,
|
|
56
|
+
isWaiting: !continuedRef.current,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Hook that delays render while a condition is true.
|
|
61
|
+
*
|
|
62
|
+
* @param {boolean} condition - If true, delays render
|
|
63
|
+
* @param {string} [label] - Label for debugging
|
|
64
|
+
* @param {object} [options] - Same options as useDelayRender
|
|
65
|
+
*
|
|
66
|
+
* Usage:
|
|
67
|
+
* const [isLoading, setIsLoading] = useState(true);
|
|
68
|
+
* useDelayRenderWhile(isLoading, 'Waiting for data');
|
|
69
|
+
*/
|
|
70
|
+
export function useDelayRenderWhile(condition, label, options = {}) {
|
|
71
|
+
const handleRef = useRef(null);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (condition && handleRef.current === null) {
|
|
74
|
+
// Start delaying
|
|
75
|
+
handleRef.current = delayRender(label || 'useDelayRenderWhile', options);
|
|
76
|
+
}
|
|
77
|
+
else if (!condition && handleRef.current !== null) {
|
|
78
|
+
// Stop delaying
|
|
79
|
+
continueRender(handleRef.current);
|
|
80
|
+
handleRef.current = null;
|
|
81
|
+
}
|
|
82
|
+
// Cleanup
|
|
83
|
+
return () => {
|
|
84
|
+
if (handleRef.current !== null) {
|
|
85
|
+
continueRender(handleRef.current);
|
|
86
|
+
handleRef.current = null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}, [condition, label]);
|
|
90
|
+
}
|
|
91
|
+
export default useDelayRender;
|
|
92
|
+
//# sourceMappingURL=useDelayRender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDelayRender.js","sourceRoot":"","sources":["../../src/hooks/useDelayRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAYjF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAmC,EACnC,UAA8B,EAAE;IAEhC,MAAM,SAAS,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;IAE5C,6BAA6B;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,WAAW,GAAW,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC;QACjF,MAAM,aAAa,GAAuB,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAEtF,SAAS,CAAC,OAAO,GAAG,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QAC5D,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;QAE7B,oDAAoD;QACpD,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;g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OAAO,CAAC,CAAC;gBAClC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,eAAe,cAAc,CAAC"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video configuration returned by `useVideoConfig`.
|
|
3
|
+
*/
|
|
4
|
+
export interface VideoConfig {
|
|
5
|
+
fps: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
durationInFrames: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns the current frame number.
|
|
12
|
+
* This is the primary hook your compositions will use.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useCurrentFrame(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the video configuration (fps, dimensions, duration).
|
|
17
|
+
*/
|
|
18
|
+
export declare function useVideoConfig(): VideoConfig;
|
|
19
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAG5C"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useTimeline } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current frame number.
|
|
4
|
+
* This is the primary hook your compositions will use.
|
|
5
|
+
*/
|
|
6
|
+
export function useCurrentFrame() {
|
|
7
|
+
const { frame } = useTimeline();
|
|
8
|
+
return frame;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns the video configuration (fps, dimensions, duration).
|
|
12
|
+
*/
|
|
13
|
+
export function useVideoConfig() {
|
|
14
|
+
const { fps, width, height, durationInFrames } = useTimeline();
|
|
15
|
+
return { fps, width, height, durationInFrames };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAYxC;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,WAAW,EAAE,CAAC;IAC/D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framely Library
|
|
3
|
+
*
|
|
4
|
+
* Main barrel export for the Framely animation framework.
|
|
5
|
+
*/
|
|
6
|
+
export { TimelineProvider, useTimeline } from './context';
|
|
7
|
+
export { default as TimelineContext } from './context';
|
|
8
|
+
export type { TimelineContextValue, TimelineProviderProps } from './context';
|
|
9
|
+
export { useCurrentFrame, useVideoConfig } from './hooks';
|
|
10
|
+
export type { VideoConfig } from './hooks';
|
|
11
|
+
export { useDelayRender, useDelayRenderWhile } from './hooks/useDelayRender';
|
|
12
|
+
export type { UseDelayRenderReturn } from './hooks/useDelayRender';
|
|
13
|
+
export { interpolate, spring } from './interpolate';
|
|
14
|
+
export type { ExtrapolationType, InterpolateOptions, SpringOptions } from './interpolate';
|
|
15
|
+
export { Easing } from './Easing';
|
|
16
|
+
export type { EasingFunction } from './Easing';
|
|
17
|
+
export { interpolateColors } from './interpolateColors';
|
|
18
|
+
export type { RGBAColor, OKLCHColor, InterpolateColorsOptions } from './interpolateColors';
|
|
19
|
+
export { measureSpring, springPresets, springNaturalFrequency, springDampingRatio } from './measureSpring';
|
|
20
|
+
export type { SpringPreset, MeasureSpringOptions } from './measureSpring';
|
|
21
|
+
export { delayRender, continueRender, cancelRender, isDelayRenderPending, getPendingDelayRenders, clearAllDelayRenders, } from './delayRender';
|
|
22
|
+
export type { DelayRenderOptions, DelayRenderHandle, PendingDelayRender } from './delayRender';
|
|
23
|
+
export { staticFile, isStaticFile, getFileExtension, getMimeType } from './staticFile';
|
|
24
|
+
export { preloadImage, preloadVideo, preloadAudio, preloadFont, prefetch, preloadAll, resolveWhenLoaded, } from './preload';
|
|
25
|
+
export { Sequence } from './Sequence';
|
|
26
|
+
export type { SequenceProps } from './Sequence';
|
|
27
|
+
export { Series } from './Series';
|
|
28
|
+
export type { SeriesSequenceProps, SeriesProps } from './Series';
|
|
29
|
+
export { Loop, useLoop } from './Loop';
|
|
30
|
+
export type { LoopContextValue, LoopProps } from './Loop';
|
|
31
|
+
export { Freeze } from './Freeze';
|
|
32
|
+
export type { FreezeProps } from './Freeze';
|
|
33
|
+
export { Folder, useFolder } from './Folder';
|
|
34
|
+
export { AbsoluteFill } from './AbsoluteFill';
|
|
35
|
+
export type { AbsoluteFillProps } from './AbsoluteFill';
|
|
36
|
+
export { Composition, defineComposition, resolveComponent, resolveMetadata, validateProps, getDefaultProps, createCompositionWrapper, } from './Composition';
|
|
37
|
+
export type { Codec, CompositionSchema, CalculateMetadataInput, CalculateMetadataOutput, CalculateMetadataFunction, CompositionProps, CompositionConfig, ResolvedMetadata, ValidationResult, } from './Composition';
|
|
38
|
+
export { registerRoot, registerRootAsync, getRoot, getCompositions, getComposition, getCompositionTree, isRootRegistered, onRootRegistered, clearRegistry, } from './registerRoot';
|
|
39
|
+
export type { CompositionConfig as RegisteredCompositionConfig, Registry, CompositionTree, } from './registerRoot';
|
|
40
|
+
export { getInputProps, setInputProps, mergeInputProps, getInputProp, hasInputProps, getInputPropsSource, clearInputProps, parsePropsInput, serializeProps, createUrlWithProps, } from './getInputProps';
|
|
41
|
+
export type { InputProps, InputPropsSource } from './getInputProps';
|
|
42
|
+
export { Config, getConfig, getConfigValue, resetConfig, loadConfig, getFfmpegArgs, getOutputExtension, validateConfig, } from './config';
|
|
43
|
+
export type { Codec as ConfigCodec, LogLevel, ImageFormat, PixelFormat, HardwareAcceleration, AudioCodec, FramelyConfig, ValidationResult as ConfigValidationResult, ConfigSetter, } from './config';
|
|
44
|
+
export { Img } from './Img';
|
|
45
|
+
export type { ImgProps } from './Img';
|
|
46
|
+
export { Video } from './Video';
|
|
47
|
+
export type { VolumeCallback as VideoVolumeCallback, VideoProps } from './Video';
|
|
48
|
+
export { Audio, getAudioMetadata, getAudioDurationInFrames } from './Audio';
|
|
49
|
+
export type { VolumeCallback as AudioVolumeCallback, AudioProps, AudioMetadata } from './Audio';
|
|
50
|
+
export { IFrame } from './IFrame';
|
|
51
|
+
export type { IFrameProps } from './IFrame';
|
|
52
|
+
export { TransitionSeries, useTransition, createPresentation, createTiming, fade, crossfade, slide, slideFromLeft, slideFromRight, slideFromTop, slideFromBottom, push, wipe, wipeLeft, wipeRight, wipeTop, wipeBottom, iris, diagonalWipe, zoom, zoomInOut, zoomOutIn, kenBurns, zoomRotate, flip, flipHorizontal, flipVertical, cardFlip, cube, door, presets as transitionPresets, } from './transitions';
|
|
53
|
+
export type { SlideDirection, SlideOptions, TransitionStyle, TransitionResult, FadeStyle, FadeOptions, FadeTransitionStyle, FadeTransitionResult, TransitionPresentation, } from './transitions';
|
|
54
|
+
export { useSpring, useSpringSequence } from './useSpring';
|
|
55
|
+
export type { UseSpringOptions, UseSpringSequenceOptions } from './useSpring';
|
|
56
|
+
export { Text, splitText, getWords } from './Text';
|
|
57
|
+
export type { CharSpanProps, CharData, StrokeConfig, ShadowConfig, WordData, TextProps, } from './Text';
|
|
58
|
+
export { Svg, Circle, Rect, Ellipse, Line, Path, Polygon, usePathLength } from './shapes';
|
|
59
|
+
export type { SvgProps, CircleProps, RectProps, EllipseProps, LineProps, PathProps, PolygonProps, } from './shapes';
|
|
60
|
+
export { useAudioData, getFrequencyBands } from './useAudioData';
|
|
61
|
+
export type { AudioDataOptions, AudioDataResult, FrequencyBandRanges, FrequencyBandValues, } from './useAudioData';
|
|
62
|
+
export { random, randomRange, randomInt, noise2D, noise3D, fbm2D } from './noise';
|
|
63
|
+
export { makeTransform, transform, interpolateTransform } from './makeTransform';
|
|
64
|
+
export { ErrorBoundary } from './ErrorBoundary';
|
|
65
|
+
export type { ErrorBoundaryProps, ErrorBoundaryState } from './ErrorBoundary';
|
|
66
|
+
export { Player, Thumbnail } from './Player';
|
|
67
|
+
export type { PlayerTimelineContextValue, PlayerProps, ThumbnailProps } from './Player';
|
|
68
|
+
export { templatesApi } from './templates/api';
|
|
69
|
+
export { CATEGORY_LABELS } from './templates/types';
|
|
70
|
+
export type { Template, TemplateCategory, TemplateAuthor, TemplatePreview, TemplatesListResponse, TemplatesFilterParams, CategoryCount, } from './templates/types';
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM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AAc,EAAE,MAAM,UAAU,CAAC;AAGxF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framely Library
|
|
3
|
+
*
|
|
4
|
+
* Main barrel export for the Framely animation framework.
|
|
5
|
+
*/
|
|
6
|
+
// Core context & provider
|
|
7
|
+
export { TimelineProvider, useTimeline } from './context';
|
|
8
|
+
export { default as TimelineContext } from './context';
|
|
9
|
+
// Hooks
|
|
10
|
+
export { useCurrentFrame, useVideoConfig } from './hooks';
|
|
11
|
+
export { useDelayRender, useDelayRenderWhile } from './hooks/useDelayRender';
|
|
12
|
+
// Animation utilities
|
|
13
|
+
export { interpolate, spring } from './interpolate';
|
|
14
|
+
export { Easing } from './Easing';
|
|
15
|
+
export { interpolateColors } from './interpolateColors';
|
|
16
|
+
export { measureSpring, springPresets, springNaturalFrequency, springDampingRatio } from './measureSpring';
|
|
17
|
+
// Delay render system
|
|
18
|
+
export { delayRender, continueRender, cancelRender, isDelayRenderPending, getPendingDelayRenders, clearAllDelayRenders, } from './delayRender';
|
|
19
|
+
// Asset utilities
|
|
20
|
+
export { staticFile, isStaticFile, getFileExtension, getMimeType } from './staticFile';
|
|
21
|
+
export { preloadImage, preloadVideo, preloadAudio, preloadFont, prefetch, preloadAll, resolveWhenLoaded, } from './preload';
|
|
22
|
+
// Layout components
|
|
23
|
+
export { Sequence } from './Sequence';
|
|
24
|
+
export { Series } from './Series';
|
|
25
|
+
export { Loop, useLoop } from './Loop';
|
|
26
|
+
export { Freeze } from './Freeze';
|
|
27
|
+
export { Folder, useFolder } from './Folder';
|
|
28
|
+
export { AbsoluteFill } from './AbsoluteFill';
|
|
29
|
+
// Composition system
|
|
30
|
+
export { Composition, defineComposition, resolveComponent, resolveMetadata, validateProps, getDefaultProps, createCompositionWrapper, } from './Composition';
|
|
31
|
+
// Registry & root
|
|
32
|
+
export { registerRoot, registerRootAsync, getRoot, getCompositions, getComposition, getCompositionTree, isRootRegistered, onRootRegistered, clearRegistry, } from './registerRoot';
|
|
33
|
+
// Input props
|
|
34
|
+
export { getInputProps, setInputProps, mergeInputProps, getInputProp, hasInputProps, getInputPropsSource, clearInputProps, parsePropsInput, serializeProps, createUrlWithProps, } from './getInputProps';
|
|
35
|
+
// Configuration
|
|
36
|
+
export { Config, getConfig, getConfigValue, resetConfig, loadConfig, getFfmpegArgs, getOutputExtension, validateConfig, } from './config';
|
|
37
|
+
// Media components
|
|
38
|
+
export { Img } from './Img';
|
|
39
|
+
export { Video } from './Video';
|
|
40
|
+
export { Audio, getAudioMetadata, getAudioDurationInFrames } from './Audio';
|
|
41
|
+
export { IFrame } from './IFrame';
|
|
42
|
+
// Transitions
|
|
43
|
+
export { TransitionSeries, useTransition, createPresentation, createTiming,
|
|
44
|
+
// Presets
|
|
45
|
+
fade, crossfade, slide, slideFromLeft, slideFromRight, slideFromTop, slideFromBottom, push, wipe, wipeLeft, wipeRight, wipeTop, wipeBottom, iris, diagonalWipe, zoom, zoomInOut, zoomOutIn, kenBurns, zoomRotate, flip, flipHorizontal, flipVertical, cardFlip, cube, door, presets as transitionPresets, } from './transitions';
|
|
46
|
+
// Spring hooks
|
|
47
|
+
export { useSpring, useSpringSequence } from './useSpring';
|
|
48
|
+
// Text component
|
|
49
|
+
export { Text, splitText, getWords } from './Text';
|
|
50
|
+
// Shape components
|
|
51
|
+
export { Svg, Circle, Rect, Ellipse, Line, Path, Polygon, usePathLength } from './shapes';
|
|
52
|
+
// Audio visualization
|
|
53
|
+
export { useAudioData, getFrequencyBands } from './useAudioData';
|
|
54
|
+
// Noise & random utilities
|
|
55
|
+
export { random, randomRange, randomInt, noise2D, noise3D, fbm2D } from './noise';
|
|
56
|
+
// Transform utilities
|
|
57
|
+
export { makeTransform, transform, interpolateTransform } from './makeTransform';
|
|
58
|
+
// Error boundary
|
|
59
|
+
export { ErrorBoundary } from './ErrorBoundary';
|
|
60
|
+
// Player
|
|
61
|
+
export { Player, Thumbnail } from './Player';
|
|
62
|
+
// Templates marketplace
|
|
63
|
+
export { templatesApi } from './templates/api';
|
|
64
|
+
export { CATEGORY_LABELS } from './templates/types';
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0BAA0B;AAC1B,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAGvD,QAAQ;AACR,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7E,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG3G,sBAAsB;AACtB,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvF,OAA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,UAAU,CAAC;AAG7C,wBAAwB;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Easing, type EasingFunction } from './Easing';
|
|
2
|
+
export { Easing };
|
|
3
|
+
export type ExtrapolationType = 'extend' | 'clamp' | 'wrap' | 'identity';
|
|
4
|
+
export interface InterpolateOptions {
|
|
5
|
+
easing?: EasingFunction;
|
|
6
|
+
extrapolateLeft?: ExtrapolationType;
|
|
7
|
+
extrapolateRight?: ExtrapolationType;
|
|
8
|
+
}
|
|
9
|
+
export interface SpringOptions {
|
|
10
|
+
from?: number;
|
|
11
|
+
to?: number;
|
|
12
|
+
fps?: number;
|
|
13
|
+
delay?: number;
|
|
14
|
+
mass?: number;
|
|
15
|
+
stiffness?: number;
|
|
16
|
+
damping?: number;
|
|
17
|
+
overshootClamping?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Maps a value from one range to another, with optional easing and extrapolation.
|
|
21
|
+
*/
|
|
22
|
+
export declare function interpolate(value: number, inputRange: readonly number[], outputRange: readonly number[], options?: InterpolateOptions): number;
|
|
23
|
+
/**
|
|
24
|
+
* Spring-based interpolation with physics-based easing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function spring(frame: number, options?: SpringOptions): number;
|
|
27
|
+
declare const _default: {
|
|
28
|
+
interpolate: typeof interpolate;
|
|
29
|
+
spring: typeof spring;
|
|
30
|
+
Easing: {
|
|
31
|
+
linear: (t: number) => number;
|
|
32
|
+
ease: EasingFunction;
|
|
33
|
+
easeIn: (t: number) => number;
|
|
34
|
+
easeOut: (t: number) => number;
|
|
35
|
+
easeInOut: (t: number) => number;
|
|
36
|
+
cubic: (t: number) => number;
|
|
37
|
+
easeInCubic: (t: number) => number;
|
|
38
|
+
easeOutCubic: (t: number) => number;
|
|
39
|
+
easeInOutCubic: (t: number) => number;
|
|
40
|
+
easeInQuart: (t: number) => number;
|
|
41
|
+
easeOutQuart: (t: number) => number;
|
|
42
|
+
easeInOutQuart: (t: number) => number;
|
|
43
|
+
easeInQuint: (t: number) => number;
|
|
44
|
+
easeOutQuint: (t: number) => number;
|
|
45
|
+
easeInOutQuint: (t: number) => number;
|
|
46
|
+
easeInSine: (t: number) => number;
|
|
47
|
+
easeOutSine: (t: number) => number;
|
|
48
|
+
easeInOutSine: (t: number) => number;
|
|
49
|
+
exp: (t: number) => number;
|
|
50
|
+
easeInExpo: (t: number) => number;
|
|
51
|
+
easeOutExpo: (t: number) => number;
|
|
52
|
+
easeInOutExpo: (t: number) => number;
|
|
53
|
+
circle: (t: number) => number;
|
|
54
|
+
easeInCirc: (t: number) => number;
|
|
55
|
+
easeOutCirc: (t: number) => number;
|
|
56
|
+
easeInOutCirc: (t: number) => number;
|
|
57
|
+
easeInBack: (t: number) => number;
|
|
58
|
+
easeOutBack: (t: number) => number;
|
|
59
|
+
easeInOutBack: (t: number) => number;
|
|
60
|
+
easeInElastic: (t: number) => number;
|
|
61
|
+
easeOutElastic: (t: number) => number;
|
|
62
|
+
easeInOutElastic: (t: number) => number;
|
|
63
|
+
bounce: (t: number) => number;
|
|
64
|
+
easeInBounce: (t: number) => number;
|
|
65
|
+
easeOutBounce: (t: number) => number;
|
|
66
|
+
easeInOutBounce: (t: number) => number;
|
|
67
|
+
spring: (t: number) => number;
|
|
68
|
+
step0: (t: number) => number;
|
|
69
|
+
step1: (t: number) => number;
|
|
70
|
+
poly: (n?: number) => EasingFunction;
|
|
71
|
+
back: (overshoot?: number) => EasingFunction;
|
|
72
|
+
elastic: (bounciness?: number) => EasingFunction;
|
|
73
|
+
bezier: (x1: number, y1: number, x2: number, y2: number) => EasingFunction;
|
|
74
|
+
in: (easing: EasingFunction) => EasingFunction;
|
|
75
|
+
out: (easing: EasingFunction) => EasingFunction;
|
|
76
|
+
inOut: (easing: EasingFunction) => EasingFunction;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export default _default;
|
|
80
|
+
//# sourceMappingURL=interpolate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../src/interpolate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAEzE,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,eAAe,CAAC,EAAE,iBAAiB,CAAC;IACpC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAgFR;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAyCzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAA+C"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Easing } from './Easing';
|
|
2
|
+
export { Easing };
|
|
3
|
+
/**
|
|
4
|
+
* Maps a value from one range to another, with optional easing and extrapolation.
|
|
5
|
+
*/
|
|
6
|
+
export function interpolate(value, inputRange, outputRange, options = {}) {
|
|
7
|
+
const { easing = Easing.linear, extrapolateLeft = 'clamp', extrapolateRight = 'clamp', } = options;
|
|
8
|
+
if (inputRange.length !== outputRange.length) {
|
|
9
|
+
throw new Error('inputRange and outputRange must have the same length');
|
|
10
|
+
}
|
|
11
|
+
if (inputRange.length < 2) {
|
|
12
|
+
throw new Error('inputRange must have at least 2 elements');
|
|
13
|
+
}
|
|
14
|
+
// Validate ranges are ascending
|
|
15
|
+
for (let i = 1; i < inputRange.length; i++) {
|
|
16
|
+
if (inputRange[i] < inputRange[i - 1]) {
|
|
17
|
+
throw new Error('inputRange must be monotonically increasing');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Find which segment we're in
|
|
21
|
+
let segIndex = 0;
|
|
22
|
+
for (let i = 1; i < inputRange.length; i++) {
|
|
23
|
+
if (value >= inputRange[i - 1]) {
|
|
24
|
+
segIndex = i - 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const inputMin = inputRange[segIndex];
|
|
28
|
+
const inputMax = inputRange[segIndex + 1] ?? inputRange[segIndex];
|
|
29
|
+
const outputMin = outputRange[segIndex];
|
|
30
|
+
const outputMax = outputRange[segIndex + 1] ?? outputRange[segIndex];
|
|
31
|
+
// Calculate progress within this segment (0 to 1)
|
|
32
|
+
let progress;
|
|
33
|
+
if (inputMax === inputMin) {
|
|
34
|
+
progress = 0;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
progress = (value - inputMin) / (inputMax - inputMin);
|
|
38
|
+
}
|
|
39
|
+
// Handle extrapolation
|
|
40
|
+
const handleExtrapolation = (p, direction) => {
|
|
41
|
+
const extrapolate = direction === 'left' ? extrapolateLeft : extrapolateRight;
|
|
42
|
+
switch (extrapolate) {
|
|
43
|
+
case 'clamp':
|
|
44
|
+
return Math.max(0, Math.min(1, p));
|
|
45
|
+
case 'extend':
|
|
46
|
+
return p;
|
|
47
|
+
case 'wrap': {
|
|
48
|
+
const wrapped = p % 1;
|
|
49
|
+
return wrapped < 0 ? wrapped + 1 : wrapped;
|
|
50
|
+
}
|
|
51
|
+
case 'identity':
|
|
52
|
+
return null;
|
|
53
|
+
default:
|
|
54
|
+
return p;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// Check if we're outside the range
|
|
58
|
+
if (progress < 0) {
|
|
59
|
+
if (extrapolateLeft === 'identity') {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
progress = handleExtrapolation(progress, 'left') ?? progress;
|
|
63
|
+
}
|
|
64
|
+
else if (progress > 1) {
|
|
65
|
+
if (extrapolateRight === 'identity') {
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
progress = handleExtrapolation(progress, 'right') ?? progress;
|
|
69
|
+
}
|
|
70
|
+
// Apply easing only to the 0-1 range
|
|
71
|
+
const easedProgress = progress < 0 || progress > 1 ? progress : easing(progress);
|
|
72
|
+
return outputMin + easedProgress * (outputMax - outputMin);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Spring-based interpolation with physics-based easing.
|
|
76
|
+
*/
|
|
77
|
+
export function spring(frame, options = {}) {
|
|
78
|
+
const { from = 0, to = 1, fps = 30, delay = 0, mass = 1, stiffness = 100, damping = 10, overshootClamping = false, } = options;
|
|
79
|
+
const f = frame - delay;
|
|
80
|
+
if (f < 0)
|
|
81
|
+
return from;
|
|
82
|
+
const omega0 = Math.sqrt(stiffness / mass);
|
|
83
|
+
const zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
|
84
|
+
const t = f / fps;
|
|
85
|
+
let progress;
|
|
86
|
+
if (zeta < 1) {
|
|
87
|
+
// Underdamped (oscillates)
|
|
88
|
+
const omegaD = omega0 * Math.sqrt(1 - zeta * zeta);
|
|
89
|
+
progress = 1 - Math.exp(-zeta * omega0 * t) *
|
|
90
|
+
(Math.cos(omegaD * t) + (zeta * omega0 / omegaD) * Math.sin(omegaD * t));
|
|
91
|
+
}
|
|
92
|
+
else if (zeta === 1) {
|
|
93
|
+
// Critically damped
|
|
94
|
+
progress = 1 - Math.exp(-omega0 * t) * (1 + omega0 * t);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// Overdamped
|
|
98
|
+
const s1 = -omega0 * (zeta - Math.sqrt(zeta * zeta - 1));
|
|
99
|
+
const s2 = -omega0 * (zeta + Math.sqrt(zeta * zeta - 1));
|
|
100
|
+
progress = 1 - (s2 * Math.exp(s1 * t) - s1 * Math.exp(s2 * t)) / (s2 - s1);
|
|
101
|
+
}
|
|
102
|
+
if (overshootClamping) {
|
|
103
|
+
progress = Math.max(0, Math.min(1, progress));
|
|
104
|
+
}
|
|
105
|
+
return from + (to - from) * progress;
|
|
106
|
+
}
|
|
107
|
+
export default { interpolate, spring, Easing };
|
|
108
|
+
//# sourceMappingURL=interpolate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolate.js","sourceRoot":"","sources":["../src/interpolate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,CAAC;AAqBlB;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,KAAa,EACb,UAA6B,EAC7B,WAA8B,EAC9B,UAA8B,EAAE;IAEhC,MAAM,EACJ,MAAM,GAAG,MAAM,CAAC,MAAM,EACtB,eAAe,GAAG,OAAO,EACzB,gBAAgB,GAAG,OAAO,GAC3B,GAAG,OAAO,CAAC;IAEZ,IAAI,UAAU,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC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;QACtB,oBAAoB;QACpB,QAAQ,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,aAAa;QACb,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,QAAQ,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,iBAAiB,EAAE,CAAC;QACtB,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC;AACvC,CAAC;AAED,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EasingFunction } from './Easing';
|
|
2
|
+
/**
|
|
3
|
+
* RGBA color with channels 0-255 for RGB and 0-1 for alpha.
|
|
4
|
+
*/
|
|
5
|
+
export interface RGBAColor {
|
|
6
|
+
r: number;
|
|
7
|
+
g: number;
|
|
8
|
+
b: number;
|
|
9
|
+
a: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Color in the OKLCH perceptual color space.
|
|
13
|
+
*/
|
|
14
|
+
export interface OKLCHColor {
|
|
15
|
+
L: number;
|
|
16
|
+
C: number;
|
|
17
|
+
H: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for interpolateColors.
|
|
21
|
+
*/
|
|
22
|
+
export interface InterpolateColorsOptions {
|
|
23
|
+
easing?: EasingFunction;
|
|
24
|
+
extrapolateLeft?: 'extend' | 'clamp';
|
|
25
|
+
extrapolateRight?: 'extend' | 'clamp';
|
|
26
|
+
colorSpace?: 'rgb' | 'oklch';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Interpolate between colors across a range.
|
|
30
|
+
*
|
|
31
|
+
* Works like interpolate() but for colors. Supports any CSS color format.
|
|
32
|
+
*
|
|
33
|
+
* Usage:
|
|
34
|
+
* interpolateColors(frame, [0, 30], ['#ff0000', '#0000ff'])
|
|
35
|
+
* interpolateColors(frame, [0, 30], ['red', 'blue'], { easing: Easing.easeOut })
|
|
36
|
+
* interpolateColors(frame, [0, 30, 60], ['red', 'yellow', 'green']) // multi-color
|
|
37
|
+
*
|
|
38
|
+
* @param {number} value - The input value (usually the current frame)
|
|
39
|
+
* @param {number[]} inputRange - Array of ascending input breakpoints
|
|
40
|
+
* @param {string[]} outputRange - Corresponding color values
|
|
41
|
+
* @param {object} [options]
|
|
42
|
+
* @param {function} [options.easing=Easing.linear] - Easing function
|
|
43
|
+
* @param {'extend'|'clamp'} [options.extrapolateLeft='clamp']
|
|
44
|
+
* @param {'extend'|'clamp'} [options.extrapolateRight='clamp']
|
|
45
|
+
* @param {'rgb'|'oklch'} [options.colorSpace='rgb'] - Interpolation color space
|
|
46
|
+
* @returns {string} Interpolated CSS color string
|
|
47
|
+
*/
|
|
48
|
+
export declare function interpolateColors(value: number, inputRange: number[], outputRange: string[], options?: InterpolateColorsOptions): string;
|
|
49
|
+
export default interpolateColors;
|
|
50
|
+
//# sourceMappingURL=interpolateColors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolateColors.d.ts","sourceRoot":"","sources":["../src/interpolateColors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,cAAc,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,eAAe,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACrC,gBAAgB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACtC,UAAU,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;CAC9B;AAiOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,GAAE,wBAA6B,GACrC,MAAM,CAsFR;AAED,eAAe,iBAAiB,CAAC"}
|