Skip to content

🎥 Make videos programmatically with React

add freeze component

Shankhadeep Deyaeaa84203b3c
diff --git a/packages/core/src/freeze.tsx b/packages/core/src/freeze.tsx
new file mode 100644
index 0000000000..fb642cf5c3
--- /dev/null
+++ b/packages/core/src/freeze.tsx
@@ -0,0 +1,25 @@
+import React, {useContext, useMemo} from 'react';
+import {TimelineContext,TimelineContextValue} from './timeline-position-state';
+
+
+type FreezeProps = {
+ frame: number;
+};
+
+const Freeze: React.FC<FreezeProps> = ({frame,children}) => {
+ const context = useContext(TimelineContext);
+ const value: TimelineContextValue = useMemo(() => {
+ return {
+ ...context,
+ frame,
+ };
+ }, [context, frame]);
+
+ return (
+ <TimelineContext.Provider value={value}>
+ {children}
+ </TimelineContext.Provider>
+ );
+};
+
+export {Freeze}
\ No newline at end of file
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 2bc7837b0f..be2b50aafb 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -23,6 +23,7 @@ export {TAsset} from './CompositionManager';
export * from './config';
export {getInputProps} from './config/input-props';
export * from './easing';
+export * from './freeze';
export * from './IFrame';
export * from './Img';
export * from './internals';