Skip to content

🎥 Make videos programmatically with React

Use existing premounting pattern in visual components

Jonny Burgeraae63fb0c6f3
diff --git a/packages/core/src/AbsoluteFill.tsx b/packages/core/src/AbsoluteFill.tsx
index 08080238a8..9ebc95a417 100644
--- a/packages/core/src/AbsoluteFill.tsx
+++ b/packages/core/src/AbsoluteFill.tsx
@@ -5,6 +5,7 @@ import {
} from './AbsoluteFillElement.js';
import type {SequenceControls} from './CompositionManager.js';
import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';
+import {Freeze} from './freeze.js';
import type {
InteractiveBaseProps,
InteractivePremountProps,
@@ -20,7 +21,8 @@ import {
transformSchema,
type InteractivitySchema,
} from './interactivity-schema.js';
-import {PremountedSequence} from './PremountedSequence.js';
+import {Sequence} from './Sequence.js';
+import {usePremounting} from './use-premounting.js';
import {useUnsafeVideoConfig} from './use-unsafe-video-config.js';
import {withInteractivitySchema} from './with-interactivity-schema.js';
@@ -58,6 +60,82 @@ const setRef = <ElementType,>(
}
};
+const AbsoluteFillWithTiming: React.FC<
+ AbsoluteFillProps & {
+ readonly controls: SequenceControls | undefined;
+ readonly outlineRef: React.RefObject<HTMLDivElement | null>;
+ }
+> = ({
+ ref: callbackRef,
+ outlineRef: refForOutline,
+ from,
+ premountFor,
+ postmountFor,
+ styleWhilePremounted,
+ styleWhilePostmounted,
+ trimBefore,
+ playbackRate,
+ freeze,
+ durationInFrames,
+ hidden,
+ name,
+ showInTimeline,
+ stack,
+ controls,
+ children,
+ ...divProps
+}) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: divProps.style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
+ return (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ durationInFrames={durationInFrames ?? Infinity}
+ hidden={hidden}
+ name={name ?? '<AbsoluteFill>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalStack={stack}
+ _remotionInternalDocumentationLink="https://www.remotion.dev/docs/absolute-fill"
+ outlineRef={refForOutline}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <AbsoluteFillElement
+ ref={callbackRef}
+ {...divProps}
+ style={premountingStyle ?? undefined}
+ >
+ {children}
+ </AbsoluteFillElement>
+ </Sequence>
+ </Freeze>
+ );
+};
+
const AbsoluteFillInner: React.FC<
AbsoluteFillProps & {readonly controls: SequenceControls | undefined}
> = ({
@@ -98,36 +176,27 @@ const AbsoluteFillInner: React.FC<
}
return (
- <PremountedSequence
- hideWhilePremounted="opacity"
- style={divProps.style ?? null}
+ <AbsoluteFillWithTiming
+ {...divProps}
+ ref={callbackRef}
+ outlineRef={refForOutline}
+ from={from}
premountFor={premountFor}
postmountFor={postmountFor}
styleWhilePremounted={styleWhilePremounted}
styleWhilePostmounted={styleWhilePostmounted}
- from={from ?? 0}
trimBefore={trimBefore}
playbackRate={playbackRate}
freeze={freeze}
- durationInFrames={durationInFrames ?? Infinity}
+ durationInFrames={durationInFrames}
hidden={hidden}
- name={name ?? '<AbsoluteFill>'}
- showInTimeline={showInTimeline ?? true}
+ name={name}
+ showInTimeline={showInTimeline}
+ stack={stack}
controls={controls}
- _remotionInternalStack={stack}
- _remotionInternalDocumentationLink="https://www.remotion.dev/docs/absolute-fill"
- outlineRef={refForOutline}
>
- {(premountingStyle) => (
- <AbsoluteFillElement
- ref={callbackRef}
- {...divProps}
- style={premountingStyle ?? undefined}
- >
- {children}
- </AbsoluteFillElement>
- )}
- </PremountedSequence>
+ {children}
+ </AbsoluteFillWithTiming>
);
};
diff --git a/packages/core/src/HtmlInCanvas.tsx b/packages/core/src/HtmlInCanvas.tsx
index 8ad5269534..6df06e2880 100644
--- a/packages/core/src/HtmlInCanvas.tsx
+++ b/packages/core/src/HtmlInCanvas.tsx
@@ -16,6 +16,7 @@ import {
useMemoizedEffects,
} from './effects/use-memoized-effects.js';
import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';
+import {Freeze} from './freeze.js';
import type {
InteractiveBaseProps,
InteractiveCropProps,
@@ -30,10 +31,11 @@ import {
transformSchema,
type InteractivitySchema,
} from './interactivity-schema.js';
-import {PremountedSequence} from './PremountedSequence.js';
+import {Sequence} from './Sequence.js';
import type {AbsoluteFillLayout} from './Sequence.js';
import {useCropStyle} from './use-crop-style.js';
import {useDelayRender} from './use-delay-render.js';
+import {usePremounting} from './use-premounting.js';
import {useRemotionEnvironment} from './use-remotion-environment.js';
import {withInteractivitySchema} from './with-interactivity-schema.js';
@@ -762,32 +764,50 @@ const HtmlInCanvasInner = forwardRef<
},
[ref],
);
+
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = usePremounting({
+ from: sequenceProps.from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
const croppedStyle = useCropStyle({
cropLeft,
cropRight,
cropTop,
cropBottom,
- style: style ?? null,
+ style: premountingStyle,
componentName: '<HtmlInCanvas />',
});
return (
- <PremountedSequence
- durationInFrames={durationInFrames}
- name={name ?? '<HtmlInCanvas>'}
- _remotionInternalDocumentationLink="https://www.remotion.dev/docs/remotion/html-in-canvas"
- controls={controls}
- _remotionInternalEffects={memoizedEffectDefinitions}
- outlineRef={actualRef}
- hideWhilePremounted="opacity"
- style={croppedStyle}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- {...sequenceProps}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ durationInFrames={durationInFrames}
+ name={name ?? '<HtmlInCanvas>'}
+ _remotionInternalDocumentationLink="https://www.remotion.dev/docs/remotion/html-in-canvas"
+ controls={controls}
+ _remotionInternalEffects={memoizedEffectDefinitions}
+ outlineRef={actualRef}
+ {...sequenceProps}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<HtmlInCanvasContent
ref={setCanvasRef}
width={width}
@@ -797,12 +817,12 @@ const HtmlInCanvasInner = forwardRef<
onInit={onInit}
pixelDensity={pixelDensity}
controls={controls}
- style={premountingStyle ?? undefined}
+ style={croppedStyle ?? undefined}
>
{children}
</HtmlInCanvasContent>
- )}
- </PremountedSequence>
+ </Sequence>
+ </Freeze>
);
},
);
diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsx
index 75bbd4c8c7..3af596095e 100644
--- a/packages/core/src/Interactive.tsx
+++ b/packages/core/src/Interactive.tsx
@@ -4,6 +4,7 @@ import type {
SequenceControls,
} from './CompositionManager.js';
import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';
+import {Freeze} from './freeze.js';
import {
backgroundSchema,
baseSchema,
@@ -20,9 +21,10 @@ import {
transformSchema,
type InteractivitySchema,
} from './interactivity-schema.js';
-import {PremountedSequence} from './PremountedSequence.js';
+import {Sequence} from './Sequence.js';
import type {AbsoluteFillLayout, SequenceProps} from './Sequence.js';
import {useCropStyle} from './use-crop-style.js';
+import {usePremounting} from './use-premounting.js';
import {
withInteractivitySchema,
type WithInteractivitySchemaOptions,
@@ -250,12 +252,31 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(
} = propsWithControls as Props & {
readonly controls: SequenceControls | undefined;
};
+
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
const croppedStyle = useCropStyle({
cropLeft,
cropRight,
cropTop,
cropBottom,
- style: style ?? null,
+ style: premountingStyle,
componentName: displayName,
});
const refForOutline = useRef<ElementType | null>(null);
@@ -268,33 +289,32 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(
);
return (
- <PremountedSequence
- hideWhilePremounted="opacity"
- style={croppedStyle}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? displayName}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- _remotionInternalDocumentationLink="https://www.remotion.dev/docs/interactive"
- outlineRef={refForOutline}
- >
- {(premountingStyle) =>
- React.createElement(tag, {
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? displayName}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalDocumentationLink="https://www.remotion.dev/docs/interactive"
+ outlineRef={refForOutline}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ {React.createElement(tag, {
...props,
- style: premountingStyle ?? undefined,
+ style: croppedStyle ?? undefined,
ref: callbackRef,
- })
- }
- </PremountedSequence>
+ })}
+ </Sequence>
+ </Freeze>
);
});
diff --git a/packages/core/src/PremountedSequence.tsx b/packages/core/src/PremountedSequence.tsx
deleted file mode 100644
index 52a723b088..0000000000
--- a/packages/core/src/PremountedSequence.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import type React from 'react';
-import {Freeze} from './freeze.js';
-import type {InteractivePremountProps} from './Interactive.js';
-import {Sequence, type SequenceProps} from './Sequence.js';
-import {usePremounting} from './use-premounting.js';
-
-// Components that own their DOM element cannot use Sequence's layout wrapper.
-// Keep the timing and registration shared, and let the caller hide its element.
-export const PremountedSequence = ({
- from = 0,
- durationInFrames = Infinity,
- premountFor,
- postmountFor,
- style,
- styleWhilePremounted,
- styleWhilePostmounted,
- hideWhilePremounted,
- children,
- ...props
-}: Omit<SequenceProps, 'children' | 'layout' | 'style'> &
- InteractivePremountProps & {
- readonly style: React.CSSProperties | null;
- readonly hideWhilePremounted: 'opacity' | 'display-none';
- readonly children: (style: React.CSSProperties | null) => React.ReactNode;
- }) => {
- const {
- effectivePremountFor,
- effectivePostmountFor,
- freezeFrame,
- isPremountingOrPostmounting,
- premountingActive,
- postmountingActive,
- premountingStyle,
- } = usePremounting({
- from,
- durationInFrames,
- premountFor: premountFor ?? null,
- postmountFor: postmountFor ?? null,
- style,
- styleWhilePremounted: styleWhilePremounted ?? null,
- styleWhilePostmounted: styleWhilePostmounted ?? null,
- hideWhilePremounted,
- });
-
- return (
- <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
- <Sequence
- {...props}
- layout="none"
- from={from}
- durationInFrames={durationInFrames}
- _remotionInternalPremountDisplay={effectivePremountFor || null}
- _remotionInternalPostmountDisplay={effectivePostmountFor || null}
- _remotionInternalIsPremounting={premountingActive}
- _remotionInternalIsPostmounting={postmountingActive}
- >
- {children(premountingStyle)}
- </Sequence>
- </Freeze>
- );
-};
diff --git a/packages/core/src/effects/Solid.tsx b/packages/core/src/effects/Solid.tsx
index 3d2e0f191d..e0d8abda6a 100644
--- a/packages/core/src/effects/Solid.tsx
+++ b/packages/core/src/effects/Solid.tsx
@@ -9,6 +9,7 @@ import React, {
} from 'react';
import type {SequenceControls} from '../CompositionManager.js';
import {addSequenceStackTraces} from '../enable-sequence-stack-traces.js';
+import {Freeze} from '../freeze.js';
import type {
InteractiveBaseProps,
InteractivePremountProps,
@@ -24,9 +25,10 @@ import {
transformSchema,
type InteractivitySchema,
} from '../interactivity-schema.js';
-import {PremountedSequence} from '../PremountedSequence.js';
+import {Sequence} from '../Sequence.js';
import {useCropStyle} from '../use-crop-style.js';
import {useDelayRender} from '../use-delay-render.js';
+import {usePremounting} from '../use-premounting.js';
import {withInteractivitySchema} from '../with-interactivity-schema.js';
import type {EffectsProp} from './effect-types.js';
import {runEffectChain} from './run-effect-chain.js';
@@ -298,38 +300,55 @@ const SolidOuter = forwardRef<
useImperativeHandle(ref, () => {
return actualRef.current as HTMLCanvasElement;
}, []);
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
const croppedStyle = useCropStyle({
cropLeft,
cropRight,
cropTop,
cropBottom,
- style: style ?? null,
+ style: premountingStyle,
componentName: '<Solid />',
});
return (
- <PremountedSequence
- hideWhilePremounted="opacity"
- style={croppedStyle}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- from={from}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- freeze={freeze}
- hidden={hidden}
- showInTimeline={showInTimeline}
- controls={controls}
- _remotionInternalEffects={memoizedEffectDefinitions}
- durationInFrames={durationInFrames}
- name={name ?? '<Solid>'}
- outlineRef={actualRef}
- _remotionInternalDocumentationLink="https://www.remotion.dev/docs/solid"
- {...props}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ showInTimeline={showInTimeline}
+ controls={controls}
+ _remotionInternalEffects={memoizedEffectDefinitions}
+ durationInFrames={durationInFrames}
+ name={name ?? '<Solid>'}
+ outlineRef={actualRef}
+ _remotionInternalDocumentationLink="https://www.remotion.dev/docs/solid"
+ {...props}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<SolidInner
reference={actualRef}
overrideId={controls?.overrideId ?? null}
@@ -337,12 +356,12 @@ const SolidOuter = forwardRef<
height={height}
width={width}
className={className}
- style={premountingStyle ?? undefined}
+ style={croppedStyle ?? undefined}
effects={effects}
pixelDensity={pixelDensity}
/>
- )}
- </PremountedSequence>
+ </Sequence>
+ </Freeze>
);
},
);
diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.ts
index 511fb20398..1e9a23555b 100644
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@ -130,7 +130,6 @@ import {portalNode, setPortalNodeCurrentScale} from './portal-node.js';
import {PrefetchProvider} from './prefetch-state.js';
import {usePreload} from './prefetch.js';
import {PremountContext} from './PremountContext.js';
-import {PremountedSequence} from './PremountedSequence.js';
import {getRoot, waitForRoot} from './register-root.js';
import type {RemotionEnvironment} from './remotion-environment-context.js';
import {RemotionEnvironmentContext} from './remotion-environment-context.js';
@@ -360,7 +359,6 @@ export const Internals = {
SequenceContext,
PremountContext,
usePremounting,
- PremountedSequence,
useRemotionContexts,
RemotionContextProvider,
CSSUtils,
diff --git a/packages/lottie/src/Lottie.tsx b/packages/lottie/src/Lottie.tsx
index 747b82e687..b87fae4db1 100644
--- a/packages/lottie/src/Lottie.tsx
+++ b/packages/lottie/src/Lottie.tsx
@@ -1,7 +1,13 @@
import type {AnimationItem} from 'lottie-web';
import lottie from 'lottie-web';
import {useEffect, useRef, useState} from 'react';
-import {Internals, useCurrentFrame, useDelayRender} from 'remotion';
+import {
+ Freeze,
+ Sequence,
+ Internals,
+ useCurrentFrame,
+ useDelayRender,
+} from 'remotion';
import type {LottieProps} from './types';
import {getLottieFrame} from './utils';
import {validateLoop} from './validate-loop';
@@ -187,25 +193,42 @@ export const Lottie = ({
style,
...props
}: LottieProps) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={style ?? null}
- from={from}
- durationInFrames={durationInFrames}
- trimBefore={trimBefore}
- freeze={freeze}
- hidden={hidden}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- name={name ?? '<Lottie>'}
- showInTimeline={showInTimeline ?? false}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ durationInFrames={durationInFrames}
+ trimBefore={trimBefore}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<Lottie>'}
+ showInTimeline={showInTimeline ?? false}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<LottieContent {...props} style={premountingStyle ?? undefined} />
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/mac-cursors/src/MacOSCursor.tsx b/packages/mac-cursors/src/MacOSCursor.tsx
index f2143c5995..68af189db6 100644
--- a/packages/mac-cursors/src/MacOSCursor.tsx
+++ b/packages/mac-cursors/src/MacOSCursor.tsx
@@ -6,7 +6,7 @@ import type {
InteractivitySchema,
SequenceControls,
} from 'remotion';
-import {Interactive, Internals} from 'remotion';
+import {Freeze, Sequence, Interactive, Internals} from 'remotion';
import {macOSCursorNames, resolveCursor} from './resolve-cursor';
export type MacOSCursorProps = InteractiveBaseProps &
@@ -75,27 +75,44 @@ const MacOSCursorInner: React.FC<
const width = resolved?.width ?? undefined;
const height = resolved?.height ?? undefined;
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={style ?? null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? '<MacOSCursor>'}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- outlineRef={refForOutline}
- >
- {(premountingStyle) =>
- resolved ? (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<MacOSCursor>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ outlineRef={refForOutline}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ {resolved ? (
<svg
ref={refForOutline}
className={className}
@@ -122,9 +139,9 @@ const MacOSCursorInner: React.FC<
preserveAspectRatio="xMinYMin meet"
/>
</svg>
- ) : null
- }
- </Internals.PremountedSequence>
+ ) : null}
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapHeatmap.tsx b/packages/maptiler/src/MapHeatmap.tsx
index 545730bd10..4e520f7c1b 100644
--- a/packages/maptiler/src/MapHeatmap.tsx
+++ b/packages/maptiler/src/MapHeatmap.tsx
@@ -5,6 +5,8 @@ import {
} from '@maptiler/sdk';
import {useContext, useEffect, useRef} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -213,23 +215,43 @@ export const MapHeatmap = (props: MapHeatmapProps) => {
playbackRate,
} = props;
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? '<MapHeatmap>'}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- >
- {() => <MapHeatmapDrawing {...props} />}
- </Internals.PremountedSequence>
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<MapHeatmap>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapHeatmapDrawing {...props} />
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapLayer.tsx b/packages/maptiler/src/MapLayer.tsx
index 5208e53667..915fcdede5 100644
--- a/packages/maptiler/src/MapLayer.tsx
+++ b/packages/maptiler/src/MapLayer.tsx
@@ -1,6 +1,8 @@
import type {LayerSpecification} from '@maptiler/sdk';
import {useContext, useEffect, useRef, useMemo} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
useDelayRender,
type InteractiveBaseProps,
@@ -153,21 +155,44 @@ export const MapLayer = ({
premountFor,
postmountFor,
...props
-}: MapLayerProps) => (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- from={from}
- durationInFrames={durationInFrames}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- freeze={freeze}
- hidden={hidden}
- showInTimeline={showInTimeline ?? false}
- premountFor={premountFor}
- postmountFor={postmountFor}
- name={name ?? '<MapLayer>'}
- >
- {() => <MapLayerContent {...props} />}
- </Internals.PremountedSequence>
-);
+}: MapLayerProps) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
+
+ return (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ durationInFrames={durationInFrames}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ showInTimeline={showInTimeline ?? false}
+ name={name ?? '<MapLayer>'}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapLayerContent {...props} />
+ </Sequence>
+ </Freeze>
+ );
+};
diff --git a/packages/maptiler/src/MapOverlay.tsx b/packages/maptiler/src/MapOverlay.tsx
index db45800c85..53a78f0290 100644
--- a/packages/maptiler/src/MapOverlay.tsx
+++ b/packages/maptiler/src/MapOverlay.tsx
@@ -8,6 +8,8 @@ import {
} from 'react';
import {
Interactive,
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -154,26 +156,43 @@ const MapOverlayRefForwardingFunction: ForwardRefRenderFunction<
useImperativeHandle(ref, () => refForOutline.current as HTMLDivElement, []);
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: {opacity, ...style},
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={{opacity, ...style}}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? '<MapOverlay>'}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- outlineRef={refForOutline}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<MapOverlay>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ outlineRef={refForOutline}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<div
ref={refForOutline}
style={{
@@ -190,8 +209,8 @@ const MapOverlayRefForwardingFunction: ForwardRefRenderFunction<
>
{children}
</div>
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapPoint.tsx b/packages/maptiler/src/MapPoint.tsx
index c253de0acd..133970d35e 100644
--- a/packages/maptiler/src/MapPoint.tsx
+++ b/packages/maptiler/src/MapPoint.tsx
@@ -5,6 +5,8 @@ import {
} from '@maptiler/sdk';
import {useContext, useEffect, useRef} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -287,23 +289,43 @@ export const MapPoint = (props: MapPointProps) => {
playbackRate,
} = props;
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? '<MapPoint>'}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- >
- {() => <MapPointDrawing {...props} />}
- </Internals.PremountedSequence>
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<MapPoint>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapPointDrawing {...props} />
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapPolygon.tsx b/packages/maptiler/src/MapPolygon.tsx
index 212e5e527d..4c5d8c0ca2 100644
--- a/packages/maptiler/src/MapPolygon.tsx
+++ b/packages/maptiler/src/MapPolygon.tsx
@@ -5,6 +5,8 @@ import {
} from '@maptiler/sdk';
import {useContext, useEffect, useMemo, useRef} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -377,23 +379,43 @@ export const MapPolygon = (props: MapPolygonProps) => {
playbackRate,
} = props;
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? '<MapPolygon>'}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- >
- {() => <MapPolygonDrawing {...props} />}
- </Internals.PremountedSequence>
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<MapPolygon>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapPolygonDrawing {...props} />
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapPolyline.tsx b/packages/maptiler/src/MapPolyline.tsx
index 052803946c..23c3f1c889 100644
--- a/packages/maptiler/src/MapPolyline.tsx
+++ b/packages/maptiler/src/MapPolyline.tsx
@@ -6,6 +6,8 @@ import {
import {length as getLineLength, lineSliceAlong, lineString} from '@turf/turf';
import {useContext, useEffect, useRef, useState} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -447,23 +449,43 @@ export const MapPolyline = (props: MapPolylineProps) => {
playbackRate,
} = props;
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? '<MapPolyline>'}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- >
- {() => <MapPolylineDrawing {...props} />}
- </Internals.PremountedSequence>
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<MapPolyline>'}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapPolylineDrawing {...props} />
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapRegion.tsx b/packages/maptiler/src/MapRegion.tsx
index 6e50aa5052..7a3e43f950 100644
--- a/packages/maptiler/src/MapRegion.tsx
+++ b/packages/maptiler/src/MapRegion.tsx
@@ -13,6 +13,8 @@ import {
} from 'react';
import {
Interactive,
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -375,24 +377,42 @@ const MapRegionRefForwardingFunction: ForwardRefRenderFunction<
useImperativeHandle(ref, () => refForOutline.current as HTMLDivElement, []);
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? `<${feature.properties.name}>`}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- outlineRef={refForOutline}
- >
- {() => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? `<${feature.properties.name}>`}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ outlineRef={refForOutline}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<>
<MapRegionDrawing
feature={feature}
@@ -406,8 +426,8 @@ const MapRegionRefForwardingFunction: ForwardRefRenderFunction<
/>
<MapRegionBounds feature={feature} refForOutline={refForOutline} />
</>
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapRoute.tsx b/packages/maptiler/src/MapRoute.tsx
index 1751bd8970..7b974982dd 100644
--- a/packages/maptiler/src/MapRoute.tsx
+++ b/packages/maptiler/src/MapRoute.tsx
@@ -13,6 +13,8 @@ import {
} from 'react';
import {
Interactive,
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -304,24 +306,42 @@ const MapRouteRefForwardingFunction: ForwardRefRenderFunction<
useImperativeHandle(ref, () => refForOutline.current as HTMLDivElement, []);
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? `<${feature.properties.name}>`}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- outlineRef={refForOutline}
- >
- {() => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? `<${feature.properties.name}>`}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ outlineRef={refForOutline}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<>
<MapRouteDrawing
feature={feature}
@@ -333,8 +353,8 @@ const MapRouteRefForwardingFunction: ForwardRefRenderFunction<
/>
<MapRouteBounds feature={feature} refForOutline={refForOutline} />
</>
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/maptiler/src/MapSource.tsx b/packages/maptiler/src/MapSource.tsx
index 4ec7db3a09..93c6b38c22 100644
--- a/packages/maptiler/src/MapSource.tsx
+++ b/packages/maptiler/src/MapSource.tsx
@@ -5,6 +5,8 @@ import type {
} from '@maptiler/sdk';
import {useContext, useEffect, useRef, type ReactNode} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
useDelayRender,
type InteractiveBaseProps,
@@ -105,21 +107,44 @@ export const MapSource = ({
premountFor,
postmountFor,
...props
-}: MapSourceProps) => (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- from={from}
- durationInFrames={durationInFrames}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- freeze={freeze}
- hidden={hidden}
- showInTimeline={showInTimeline ?? false}
- premountFor={premountFor}
- postmountFor={postmountFor}
- name={name ?? '<MapSource>'}
- >
- {() => <MapSourceContent {...props} />}
- </Internals.PremountedSequence>
-);
+}: MapSourceProps) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: null,
+ styleWhilePostmounted: null,
+ hideWhilePremounted: 'opacity',
+ });
+
+ return (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ durationInFrames={durationInFrames}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ showInTimeline={showInTimeline ?? false}
+ name={name ?? '<MapSource>'}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapSourceContent {...props} />
+ </Sequence>
+ </Freeze>
+ );
+};
diff --git a/packages/maptiler/src/MapViewport.tsx b/packages/maptiler/src/MapViewport.tsx
index 0baf160691..91597eb1a7 100644
--- a/packages/maptiler/src/MapViewport.tsx
+++ b/packages/maptiler/src/MapViewport.tsx
@@ -1,11 +1,11 @@
import {Map as MapTilerMap, MapStyle, type MapOptions} from '@maptiler/sdk';
-import '@maptiler/sdk/style.css';
import type {
ComponentType,
CSSProperties,
ForwardRefRenderFunction,
ReactNode,
} from 'react';
+import '@maptiler/sdk/style.css';
import {
forwardRef,
useEffect,
@@ -16,6 +16,8 @@ import {
} from 'react';
import {
Interactive,
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -563,33 +565,53 @@ const MapViewportRefForwardingFunction: ForwardRefRenderFunction<
...props
},
ref,
-) => (
- <Internals.PremountedSequence
- style={null}
- hideWhilePremounted="opacity"
- durationInFrames={durationInFrames}
- from={from}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- freeze={freeze}
- hidden={hidden}
- showInTimeline={showInTimeline}
- controls={controls}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- name={name ?? '<MapViewport>'}
- >
- {(premountingStyle) => (
- <MapViewportContent
- {...props}
- ref={ref}
- premountingStyle={premountingStyle}
- />
- )}
- </Internals.PremountedSequence>
-);
+) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
+
+ return (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ durationInFrames={durationInFrames}
+ from={from}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ showInTimeline={showInTimeline}
+ controls={controls}
+ name={name ?? '<MapViewport>'}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ <MapViewportContent
+ {...props}
+ ref={ref}
+ premountingStyle={premountingStyle}
+ />
+ </Sequence>
+ </Freeze>
+ );
+};
const MapViewportInner = forwardRef(MapViewportRefForwardingFunction);
diff --git a/packages/rive/src/RemotionRiveCanvas.tsx b/packages/rive/src/RemotionRiveCanvas.tsx
index 24bbb5a05d..7203fb4ce3 100644
--- a/packages/rive/src/RemotionRiveCanvas.tsx
+++ b/packages/rive/src/RemotionRiveCanvas.tsx
@@ -24,6 +24,8 @@ import type {
InteractivitySchema,
} from 'remotion';
import {
+ Freeze,
+ Sequence,
Internals,
Interactive,
useCurrentFrame,
@@ -464,42 +466,59 @@ const RemotionRiveCanvasInnerForwardRefFunction: React.ForwardRefRenderFunction<
const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
const canvasRef = useRef<HTMLCanvasElement | null>(null);
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
const croppedStyle = Internals.useCropStyle({
cropLeft,
cropRight,
cropTop,
cropBottom,
- style: style ?? null,
+ style: premountingStyle,
componentName: '<RemotionRiveCanvas />',
});
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={croppedStyle}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- from={from}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- freeze={freeze}
- hidden={hidden}
- showInTimeline={showInTimeline}
- name={name ?? '<RemotionRiveCanvas>'}
- _remotionInternalDocumentationLink={
- name === undefined
- ? 'https://www.remotion.dev/docs/rive/remotionrivecanvas'
- : undefined
- }
- durationInFrames={durationInFrames}
- controls={controls}
- _remotionInternalEffects={memoizedEffectDefinitions}
- outlineRef={canvasRef}
- {...props}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ showInTimeline={showInTimeline}
+ name={name ?? '<RemotionRiveCanvas>'}
+ _remotionInternalDocumentationLink={
+ name === undefined
+ ? 'https://www.remotion.dev/docs/rive/remotionrivecanvas'
+ : undefined
+ }
+ durationInFrames={durationInFrames}
+ controls={controls}
+ _remotionInternalEffects={memoizedEffectDefinitions}
+ outlineRef={canvasRef}
+ {...props}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<RemotionRiveCanvasContent
ref={ref}
src={src}
@@ -511,13 +530,13 @@ const RemotionRiveCanvasInnerForwardRefFunction: React.ForwardRefRenderFunction<
assetLoader={assetLoader}
enableRiveAssetCdn={enableRiveAssetCdn}
className={className}
- style={premountingStyle ?? undefined}
+ style={croppedStyle ?? undefined}
effects={effects}
controls={controls}
canvasRef={canvasRef}
/>
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/rough-notation/src/Annotation.tsx b/packages/rough-notation/src/Annotation.tsx
index 5ff692a243..861a330972 100644
--- a/packages/rough-notation/src/Annotation.tsx
+++ b/packages/rough-notation/src/Annotation.tsx
@@ -1,6 +1,8 @@
import React, {useMemo} from 'react';
import {
Interactive,
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -408,27 +410,44 @@ const makeAnnotationComponent = ({
/>
);
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={null}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- from={from ?? 0}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- durationInFrames={durationInFrames ?? Infinity}
- freeze={freeze}
- hidden={hidden}
- name={name ?? `<${componentName}>`}
- showInTimeline={showInTimeline ?? true}
- controls={controls}
- _remotionInternalDocumentationLink={`https://www.remotion.dev/docs/rough-notation/${documentationSlug}`}
- outlineRef={outlineRef}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from ?? 0}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? `<${componentName}>`}
+ showInTimeline={showInTimeline ?? true}
+ controls={controls}
+ _remotionInternalDocumentationLink={`https://www.remotion.dev/docs/rough-notation/${documentationSlug}`}
+ outlineRef={outlineRef}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<span
ref={outlineRef}
style={{
@@ -443,8 +462,8 @@ const makeAnnotationComponent = ({
{layer === 'on-top' ? annotationElement : null}
</annotation.Container>
</span>
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};
diff --git a/packages/shapes/src/components/render-svg.tsx b/packages/shapes/src/components/render-svg.tsx
index c63eb8aa12..f6199c204c 100644
--- a/packages/shapes/src/components/render-svg.tsx
+++ b/packages/shapes/src/components/render-svg.tsx
@@ -3,6 +3,8 @@ import React, {useCallback, useMemo, useRef} from 'react';
import {version} from 'react-dom';
import {
HtmlInCanvas,
+ Freeze,
+ Sequence,
Internals,
type EffectsProp,
type HtmlInCanvasPixelDensity,
@@ -36,6 +38,83 @@ export type AllShapesProps = Omit<
readonly pixelDensity?: HtmlInCanvasPixelDensity;
};
+const RenderSvgWithTiming = ({
+ premountFor,
+ postmountFor,
+ styleWhilePremounted,
+ styleWhilePostmounted,
+ from,
+ trimBefore,
+ playbackRate,
+ freeze,
+ hidden,
+ showInTimeline,
+ controls,
+ durationInFrames,
+ name,
+ defaultName,
+ outlineRef,
+ documentationLink,
+ memoizedEffectDefinitions,
+ content,
+ actualStyle,
+}: ShapeSequenceProps & {
+ readonly defaultName: string;
+ readonly documentationLink: string;
+ readonly content: React.ReactElement<Pick<AllShapesProps, 'style'>>;
+ readonly actualStyle: React.CSSProperties;
+ readonly outlineRef: React.RefObject<Element | null>;
+ readonly memoizedEffectDefinitions: ReturnType<
+ typeof Internals.useMemoizedEffectDefinitions
+ >;
+}) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: actualStyle,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
+ return (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ showInTimeline={showInTimeline}
+ controls={controls}
+ _remotionInternalEffects={memoizedEffectDefinitions}
+ durationInFrames={durationInFrames}
+ name={name ?? defaultName}
+ outlineRef={outlineRef}
+ _remotionInternalDocumentationLink={
+ name === undefined ? documentationLink : undefined
+ }
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
+ {React.cloneElement(content, {style: premountingStyle ?? undefined})}
+ </Sequence>
+ </Freeze>
+ );
+};
+
export const RenderSvg = ({
defaultName,
documentationLink,
@@ -55,7 +134,6 @@ export const RenderSvg = ({
postmountFor,
styleWhilePremounted,
styleWhilePostmounted,
-
trimBefore,
playbackRate,
freeze,
@@ -216,9 +294,7 @@ export const RenderSvg = ({
}
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={actualStyle}
+ <RenderSvgWithTiming
premountFor={premountFor}
postmountFor={postmountFor}
styleWhilePremounted={styleWhilePremounted}
@@ -230,17 +306,14 @@ export const RenderSvg = ({
hidden={hidden}
showInTimeline={showInTimeline}
controls={controls}
- _remotionInternalEffects={memoizedEffectDefinitions}
durationInFrames={durationInFrames}
- name={name ?? defaultName}
+ name={name}
+ defaultName={defaultName}
outlineRef={outlineRef}
- _remotionInternalDocumentationLink={
- name === undefined ? documentationLink : undefined
- }
- >
- {(premountingStyle) =>
- React.cloneElement(content, {style: premountingStyle ?? undefined})
- }
- </Internals.PremountedSequence>
+ documentationLink={documentationLink}
+ memoizedEffectDefinitions={memoizedEffectDefinitions}
+ content={content}
+ actualStyle={actualStyle}
+ />
);
};
diff --git a/packages/three/src/ThreeCanvas.tsx b/packages/three/src/ThreeCanvas.tsx
index 4238234c3e..525d01c5d0 100644
--- a/packages/three/src/ThreeCanvas.tsx
+++ b/packages/three/src/ThreeCanvas.tsx
@@ -8,6 +8,8 @@ import React, {
useState,
} from 'react';
import {
+ Freeze,
+ Sequence,
Internals,
type InteractiveBaseProps,
type InteractivePremountProps,
@@ -169,27 +171,44 @@ export const ThreeCanvasInternals = ({
style,
...props
}: ThreeCanvasInternalsProps) => {
+ const {
+ effectivePremountFor,
+ effectivePostmountFor,
+ freezeFrame,
+ isPremountingOrPostmounting,
+ premountingActive,
+ postmountingActive,
+ premountingStyle,
+ } = Internals.usePremounting({
+ from: from ?? 0,
+ durationInFrames: durationInFrames ?? Infinity,
+ premountFor: premountFor ?? null,
+ postmountFor: postmountFor ?? null,
+ style: style ?? null,
+ styleWhilePremounted: styleWhilePremounted ?? null,
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
+ hideWhilePremounted: 'opacity',
+ });
return (
- <Internals.PremountedSequence
- hideWhilePremounted="opacity"
- style={style ?? null}
- from={from}
- durationInFrames={durationInFrames}
- trimBefore={trimBefore}
- playbackRate={playbackRate}
- freeze={freeze}
- hidden={hidden}
- premountFor={premountFor}
- postmountFor={postmountFor}
- styleWhilePremounted={styleWhilePremounted}
- styleWhilePostmounted={styleWhilePostmounted}
- name={name ?? '<ThreeCanvas>'}
- showInTimeline={showInTimeline ?? false}
- >
- {(premountingStyle) => (
+ <Freeze frame={freezeFrame} active={isPremountingOrPostmounting}>
+ <Sequence
+ layout="none"
+ from={from}
+ durationInFrames={durationInFrames}
+ trimBefore={trimBefore}
+ playbackRate={playbackRate}
+ freeze={freeze}
+ hidden={hidden}
+ name={name ?? '<ThreeCanvas>'}
+ showInTimeline={showInTimeline ?? false}
+ _remotionInternalPremountDisplay={effectivePremountFor || null}
+ _remotionInternalPostmountDisplay={effectivePostmountFor || null}
+ _remotionInternalIsPremounting={premountingActive}
+ _remotionInternalIsPostmounting={postmountingActive}
+ >
<ThreeCanvasContent {...props} style={premountingStyle ?? undefined} />
- )}
- </Internals.PremountedSequence>
+ </Sequence>
+ </Freeze>
);
};