@remotion/transitions 4.0.499 → 4.0.501

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.
@@ -43,9 +43,9 @@ const flatten_children_js_1 = require("./flatten-children.js");
43
43
  const slide_js_1 = require("./presentations/slide.js");
44
44
  const validate_js_1 = require("./validate.js");
45
45
  const { SequenceWithoutSchema } = remotion_1.Internals;
46
- const TransitionSeriesTransitionInner = ({ stack = null, _remotionInternalRender = null, ...props }) => {
46
+ const TransitionSeriesTransitionInner = ({ _remotionInternalRender = null, ...props }) => {
47
47
  if (_remotionInternalRender) {
48
- return _remotionInternalRender({ ...props, stack });
48
+ return _remotionInternalRender(props);
49
49
  }
50
50
  return null;
51
51
  };
@@ -57,9 +57,9 @@ const TransitionSeriesTransition = remotion_1.Interactive.withSchema({
57
57
  schema: transitionSeriesTransitionSchema,
58
58
  supportsEffects: false,
59
59
  });
60
- const SeriesOverlayInner = ({ stack = null, _remotionInternalRender = null, ...props }) => {
60
+ const SeriesOverlayInner = ({ _remotionInternalRender = null, ...props }) => {
61
61
  if (_remotionInternalRender) {
62
- return _remotionInternalRender({ ...props, stack });
62
+ return _remotionInternalRender(props);
63
63
  }
64
64
  return null;
65
65
  };
@@ -80,13 +80,12 @@ const transitionSeriesSequenceSchema = {
80
80
  trimBefore: remotion_1.Internals.sequenceSchema.trimBefore,
81
81
  layout: remotion_1.Internals.sequenceSchema.layout,
82
82
  };
83
- const SeriesSequenceInner = ({ offset = 0, className = '', stack = null, _remotionInternalRender = null, ...props }) => {
83
+ const SeriesSequenceInner = ({ offset = 0, className = '', _remotionInternalRender = null, ...props }) => {
84
84
  if (_remotionInternalRender) {
85
85
  return _remotionInternalRender({
86
86
  ...props,
87
87
  offset,
88
88
  className: className || undefined,
89
- stack,
90
89
  });
91
90
  }
92
91
  // eslint-disable-next-line react/jsx-no-useless-fragment
@@ -150,8 +149,8 @@ const TransitionSeriesChildren = ({ children, }) => {
150
149
  const { index: i, transitionOffsets, startFrame, overlayRenders, sequenceDurations, pendingOverlayValidation, } = state;
151
150
  if (i === flattedChildren.length) {
152
151
  return overlayRenders.map((info) => {
153
- var _a, _b;
154
- return (jsx_runtime_1.jsx(SequenceWithoutSchema, { from: Math.round(info.overlayFrom), durationInFrames: info.durationInFrames, name: "<TS.Overlay>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/transitions/transitionseries", _remotionInternalStack: (_a = info.stack) !== null && _a !== void 0 ? _a : undefined, controls: (_b = info.controls) !== null && _b !== void 0 ? _b : undefined, layout: "absolute-fill", children: info.children }, `overlay-${info.index}`));
152
+ var _a;
153
+ return (jsx_runtime_1.jsx(SequenceWithoutSchema, { from: Math.round(info.overlayFrom), durationInFrames: info.durationInFrames, name: "<TS.Overlay>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/transitions/transitionseries", controls: (_a = info.controls) !== null && _a !== void 0 ? _a : undefined, layout: "absolute-fill", children: info.children }, `overlay-${info.index}`));
155
154
  });
156
155
  }
157
156
  const child = flattedChildren[i];
@@ -234,7 +233,6 @@ const TransitionSeriesChildren = ({ children, }) => {
234
233
  children: overlayProps.children,
235
234
  index: i,
236
235
  controls: overlayProps.controls,
237
- stack: overlayProps.stack,
238
236
  };
239
237
  return renderNext({
240
238
  overlayRenders: [...overlayRenders, overlayRender],
@@ -253,10 +251,10 @@ const TransitionSeriesChildren = ({ children, }) => {
253
251
  const castedTransition = current;
254
252
  return react_1.default.cloneElement(castedTransition, {
255
253
  _remotionInternalRender: (transitionProps) => {
256
- var _a, _b;
254
+ var _a;
257
255
  const transitionDuration = transitionProps.timing.getDurationInFrames({ fps });
258
256
  const transitionFrom = startFrame + transitionOffsets - transitionDuration;
259
- return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [transitionDuration > 0 ? (jsx_runtime_1.jsx(SequenceWithoutSchema, { from: transitionFrom, durationInFrames: transitionDuration, name: "<TS.Transition>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/transitions/transitionseries", _remotionInternalStack: (_a = transitionProps.stack) !== null && _a !== void 0 ? _a : undefined, controls: (_b = transitionProps.controls) !== null && _b !== void 0 ? _b : undefined, layout: "none" })) : null, renderNext()] }));
257
+ return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [transitionDuration > 0 ? (jsx_runtime_1.jsx(SequenceWithoutSchema, { from: transitionFrom, durationInFrames: transitionDuration, name: "<TS.Transition>", _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/transitions/transitionseries", controls: (_a = transitionProps.controls) !== null && _a !== void 0 ? _a : undefined, layout: "none" })) : null, renderNext()] }));
260
258
  },
261
259
  });
262
260
  }
@@ -279,7 +277,11 @@ const TransitionSeriesChildren = ({ children, }) => {
279
277
  var _a, _b, _c, _d, _e, _f, _g, _h;
280
278
  const durationInFramesProp = resolvedProps.durationInFrames;
281
279
  const debugInfo = `index = ${i}, duration = ${durationInFramesProp}`;
282
- const { durationInFrames, children: sequenceChildren, offset: offsetProp, controls, stack, from: _from, ...passedProps } = resolvedProps;
280
+ const { durationInFrames, children: sequenceChildren, offset: offsetProp, controls, from: _from, ...passedProps } = resolvedProps;
281
+ const propsForSequence = {
282
+ ...passedProps,
283
+ _remotionInternalSingleChildComponent: remotion_1.Internals.getSingleChildComponent(sequenceChildren),
284
+ };
283
285
  (0, validate_js_1.validateDurationInFrames)(durationInFramesProp, {
284
286
  component: `of a <TransitionSeries.Sequence /> component`,
285
287
  allowFloats: true,
@@ -366,9 +368,9 @@ const TransitionSeriesChildren = ({ children, }) => {
366
368
  const prevPresentation = (_b = prev.props.presentation) !== null && _b !== void 0 ? _b : (0, slide_js_1.slide)();
367
369
  const UppercaseNextPresentation = nextPresentation.component;
368
370
  const UppercasePrevPresentation = prevPresentation.component;
369
- return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...passedProps, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
371
+ return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...propsForSequence, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
370
372
  ? undefined
371
- : 'https://www.remotion.dev/docs/transitions/transitionseries', _remotionInternalStack: stack !== null && stack !== void 0 ? stack : undefined, controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(UppercaseNextPresentation, { passedProps: (_c = nextPresentation.props) !== null && _c !== void 0 ? _c : {}, presentationDirection: "exiting", presentationProgress: nextProgress, presentationDurationInFrames: next.props.timing.getDurationInFrames({ fps }), onElementImage: () => {
373
+ : 'https://www.remotion.dev/docs/transitions/transitionseries', controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(UppercaseNextPresentation, { passedProps: (_c = nextPresentation.props) !== null && _c !== void 0 ? _c : {}, presentationDirection: "exiting", presentationProgress: nextProgress, presentationDurationInFrames: next.props.timing.getDurationInFrames({ fps }), onElementImage: () => {
372
374
  throw new Error('Should not call when exiting');
373
375
  }, onUnmount: () => {
374
376
  throw new Error('Should not call when exiting');
@@ -383,24 +385,24 @@ const TransitionSeriesChildren = ({ children, }) => {
383
385
  if (prevProgress !== null && prev) {
384
386
  const prevPresentation = (_e = prev.props.presentation) !== null && _e !== void 0 ? _e : (0, slide_js_1.slide)();
385
387
  const UppercasePrevPresentation = prevPresentation.component;
386
- return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...passedProps, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
388
+ return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...propsForSequence, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
387
389
  ? undefined
388
- : 'https://www.remotion.dev/docs/transitions/transitionseries', _remotionInternalStack: stack !== null && stack !== void 0 ? stack : undefined, controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(UppercasePrevPresentation, { passedProps: (_f = prevPresentation.props) !== null && _f !== void 0 ? _f : {}, presentationDirection: "entering", presentationProgress: prevProgress, presentationDurationInFrames: prev.props.timing.getDurationInFrames({ fps }), onElementImage: (elementImage, draw) => onNextElementImage(elementImage, prevProgress, draw, i - 1), onUnmount: () => {
390
+ : 'https://www.remotion.dev/docs/transitions/transitionseries', controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(UppercasePrevPresentation, { passedProps: (_f = prevPresentation.props) !== null && _f !== void 0 ? _f : {}, presentationDirection: "entering", presentationProgress: prevProgress, presentationDurationInFrames: prev.props.timing.getDurationInFrames({ fps }), onElementImage: (elementImage, draw) => onNextElementImage(elementImage, prevProgress, draw, i - 1), onUnmount: () => {
389
391
  onNextElementImage(null, null, null, i - 1);
390
392
  }, bothEnteringAndExiting: false, children: jsx_runtime_1.jsx(context_js_1.WrapInEnteringProgressContext, { presentationProgress: prevProgress, children: sequenceChildren }) }) }, i));
391
393
  }
392
394
  if (nextProgress !== null && next) {
393
395
  const nextPresentation = (_g = next.props.presentation) !== null && _g !== void 0 ? _g : (0, slide_js_1.slide)();
394
396
  const UppercaseNextPresentation = nextPresentation.component;
395
- return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...passedProps, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
397
+ return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...propsForSequence, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
396
398
  ? undefined
397
- : 'https://www.remotion.dev/docs/transitions/transitionseries', _remotionInternalStack: stack !== null && stack !== void 0 ? stack : undefined, controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(UppercaseNextPresentation, { passedProps: (_h = nextPresentation.props) !== null && _h !== void 0 ? _h : {}, presentationDirection: "exiting", presentationProgress: nextProgress, presentationDurationInFrames: next.props.timing.getDurationInFrames({ fps }), onElementImage: (elementImage, draw) => onPrevElementImage(elementImage, nextProgress, draw, i + 1), onUnmount: () => {
399
+ : 'https://www.remotion.dev/docs/transitions/transitionseries', controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(UppercaseNextPresentation, { passedProps: (_h = nextPresentation.props) !== null && _h !== void 0 ? _h : {}, presentationDirection: "exiting", presentationProgress: nextProgress, presentationDurationInFrames: next.props.timing.getDurationInFrames({ fps }), onElementImage: (elementImage, draw) => onPrevElementImage(elementImage, nextProgress, draw, i + 1), onUnmount: () => {
398
400
  onPrevElementImage(null, null, null, i + 1);
399
401
  }, bothEnteringAndExiting: false, children: jsx_runtime_1.jsx(context_js_1.WrapInExitingProgressContext, { presentationProgress: nextProgress, children: sequenceChildren }) }) }, i));
400
402
  }
401
- return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...passedProps, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
403
+ return renderSequenceAndRest(jsx_runtime_1.jsx(SequenceWithoutSchema, { from: actualStartFrame, durationInFrames: durationInFramesProp, ...propsForSequence, name: passedProps.name || '<TS.Sequence>', _remotionInternalDocumentationLink: passedProps.name
402
404
  ? undefined
403
- : 'https://www.remotion.dev/docs/transitions/transitionseries', _remotionInternalStack: stack !== null && stack !== void 0 ? stack : undefined, controls: controls !== null && controls !== void 0 ? controls : undefined, children: sequenceChildren }, i));
405
+ : 'https://www.remotion.dev/docs/transitions/transitionseries', controls: controls !== null && controls !== void 0 ? controls : undefined, children: sequenceChildren }, i));
404
406
  },
405
407
  });
406
408
  };
@@ -422,7 +424,6 @@ const TransitionSeriesChildren = ({ children, }) => {
422
424
  */
423
425
  const TransitionSeriesInner = (props) => {
424
426
  const { children, name, layout: passedLayout, controls, ...otherProps } = props;
425
- const { stack, ...propsForSequence } = otherProps;
426
427
  const displayName = name !== null && name !== void 0 ? name : '<TransitionSeries>';
427
428
  const layout = passedLayout !== null && passedLayout !== void 0 ? passedLayout : 'absolute-fill';
428
429
  if (no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES &&
@@ -431,7 +432,7 @@ const TransitionSeriesInner = (props) => {
431
432
  }
432
433
  return (jsx_runtime_1.jsx(remotion_1.Sequence, { name: displayName, layout: layout, _remotionInternalDocumentationLink: name === undefined
433
434
  ? 'https://www.remotion.dev/docs/transitions/transitionseries'
434
- : undefined, ...propsForSequence, _remotionInternalStack: stack !== null && stack !== void 0 ? stack : undefined, controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(TransitionSeriesChildren, { children: children }) }));
435
+ : undefined, ...otherProps, controls: controls !== null && controls !== void 0 ? controls : undefined, children: jsx_runtime_1.jsx(TransitionSeriesChildren, { children: children }) }));
435
436
  };
436
437
  const TransitionSeries = remotion_1.Interactive.withSchema({
437
438
  Component: TransitionSeriesInner,
@@ -1122,15 +1122,139 @@ var linearBlurShader = (canvas) => {
1122
1122
  };
1123
1123
  var linearBlur = makeHtmlInCanvasPresentation(linearBlurShader);
1124
1124
 
1125
+ // src/presentations/push-cut.tsx
1126
+ import { useMemo as useMemo3 } from "react";
1127
+ import { AbsoluteFill as AbsoluteFill3, Easing, interpolate } from "remotion";
1128
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1129
+ var clamp = {
1130
+ extrapolateLeft: "clamp",
1131
+ extrapolateRight: "clamp"
1132
+ };
1133
+ var validateFiniteNumber = (name, value) => {
1134
+ if (!Number.isFinite(value)) {
1135
+ throw new TypeError(`${name} passed to pushCut() must be finite, received ${value}`);
1136
+ }
1137
+ };
1138
+ var validateProps = (props) => {
1139
+ const cutProgress = props.cutProgress ?? 5 / 11;
1140
+ const outgoingScale = props.outgoingScale ?? 1.04;
1141
+ const incomingStartScale = props.incomingStartScale ?? 1.04;
1142
+ const incomingEndScale = props.incomingEndScale ?? 1.07;
1143
+ const flashOpacity = props.flashOpacity ?? 0.2;
1144
+ const flashFrames = props.flashFrames ?? 2;
1145
+ validateFiniteNumber("cutProgress", cutProgress);
1146
+ if (cutProgress <= 0 || cutProgress >= 1) {
1147
+ throw new TypeError(`cutProgress passed to pushCut() must be greater than 0 and less than 1, received ${cutProgress}`);
1148
+ }
1149
+ for (const [name, value] of [
1150
+ ["outgoingScale", outgoingScale],
1151
+ ["incomingStartScale", incomingStartScale],
1152
+ ["incomingEndScale", incomingEndScale]
1153
+ ]) {
1154
+ validateFiniteNumber(name, value);
1155
+ if (value <= 0) {
1156
+ throw new TypeError(`${name} passed to pushCut() must be greater than 0, received ${value}`);
1157
+ }
1158
+ }
1159
+ validateFiniteNumber("flashOpacity", flashOpacity);
1160
+ if (flashOpacity < 0 || flashOpacity > 1) {
1161
+ throw new TypeError(`flashOpacity passed to pushCut() must be between 0 and 1, received ${flashOpacity}`);
1162
+ }
1163
+ validateFiniteNumber("flashFrames", flashFrames);
1164
+ if (flashFrames < 0) {
1165
+ throw new TypeError(`flashFrames passed to pushCut() must be greater than or equal to 0, received ${flashFrames}`);
1166
+ }
1167
+ };
1168
+ var PushCutPresentation = ({
1169
+ children,
1170
+ presentationDirection,
1171
+ presentationDurationInFrames,
1172
+ presentationProgress,
1173
+ passedProps
1174
+ }) => {
1175
+ const {
1176
+ cutProgress = 5 / 11,
1177
+ outgoingScale = 1.04,
1178
+ incomingStartScale = 1.04,
1179
+ incomingEndScale = 1.07,
1180
+ transformOrigin = "50% 50%",
1181
+ flashColor = "#f5f2ed",
1182
+ flashOpacity: peakFlashOpacity = 0.2,
1183
+ flashFrames = 2,
1184
+ outerEnterStyle,
1185
+ outerExitStyle,
1186
+ innerEnterStyle,
1187
+ innerExitStyle
1188
+ } = passedProps;
1189
+ const isEntering = presentationDirection === "entering";
1190
+ const outgoingProgress = interpolate(presentationProgress, [0, cutProgress], [0, 1], {
1191
+ ...clamp,
1192
+ easing: Easing.in(Easing.quad)
1193
+ });
1194
+ const incomingProgress = interpolate(presentationProgress, [cutProgress, 1], [0, 1], {
1195
+ ...clamp,
1196
+ easing: Easing.out(Easing.quad)
1197
+ });
1198
+ const scale = isEntering ? interpolate(incomingProgress, [0, 1], [incomingStartScale, incomingEndScale]) : interpolate(outgoingProgress, [0, 1], [1, outgoingScale]);
1199
+ const oneFrame = 1 / Math.max(1, presentationDurationInFrames);
1200
+ const flashTail = flashFrames / Math.max(1, presentationDurationInFrames);
1201
+ const flashOpacity = isEntering ? interpolate(presentationProgress, [cutProgress, cutProgress + flashTail], [peakFlashOpacity, 0], clamp) : interpolate(presentationProgress, [cutProgress - oneFrame, cutProgress], [0, peakFlashOpacity], clamp);
1202
+ const outerStyle = useMemo3(() => {
1203
+ return {
1204
+ opacity: isEntering && presentationProgress < cutProgress ? 0 : 1,
1205
+ overflow: "hidden",
1206
+ ...isEntering ? outerEnterStyle : outerExitStyle
1207
+ };
1208
+ }, [
1209
+ cutProgress,
1210
+ isEntering,
1211
+ outerEnterStyle,
1212
+ outerExitStyle,
1213
+ presentationProgress
1214
+ ]);
1215
+ const innerStyle = useMemo3(() => {
1216
+ return {
1217
+ transform: `scale(${scale})`,
1218
+ transformOrigin,
1219
+ willChange: "transform",
1220
+ ...isEntering ? innerEnterStyle : innerExitStyle
1221
+ };
1222
+ }, [innerEnterStyle, innerExitStyle, isEntering, scale, transformOrigin]);
1223
+ return /* @__PURE__ */ jsxs2(AbsoluteFill3, {
1224
+ style: outerStyle,
1225
+ children: [
1226
+ /* @__PURE__ */ jsx3(AbsoluteFill3, {
1227
+ style: innerStyle,
1228
+ children
1229
+ }),
1230
+ flashOpacity > 0 ? /* @__PURE__ */ jsx3(AbsoluteFill3, {
1231
+ style: {
1232
+ backgroundColor: flashColor,
1233
+ opacity: flashOpacity,
1234
+ pointerEvents: "none"
1235
+ }
1236
+ }) : null
1237
+ ]
1238
+ });
1239
+ };
1240
+ var pushCut = (props) => {
1241
+ const passedProps = props ?? {};
1242
+ validateProps(passedProps);
1243
+ return {
1244
+ component: PushCutPresentation,
1245
+ props: passedProps
1246
+ };
1247
+ };
1248
+
1125
1249
  // src/timings/linear-timing.ts
1126
- import { interpolate } from "remotion";
1250
+ import { interpolate as interpolate2 } from "remotion";
1127
1251
  var linearTiming = (options) => {
1128
1252
  return {
1129
1253
  getDurationInFrames: () => {
1130
1254
  return options.durationInFrames;
1131
1255
  },
1132
1256
  getProgress: ({ frame }) => {
1133
- return interpolate(frame, [0, options.durationInFrames], [0, 1], {
1257
+ return interpolate2(frame, [0, options.durationInFrames], [0, 1], {
1134
1258
  easing: options.easing,
1135
1259
  extrapolateLeft: "clamp",
1136
1260
  extrapolateRight: "clamp"
@@ -1169,7 +1293,7 @@ var springTiming = (options = {}) => {
1169
1293
  };
1170
1294
  };
1171
1295
  // src/TransitionSeries.tsx
1172
- import React4, { useCallback as useCallback2, useMemo as useMemo4, useRef as useRef2 } from "react";
1296
+ import React4, { useCallback as useCallback2, useMemo as useMemo5, useRef as useRef2 } from "react";
1173
1297
  import {
1174
1298
  Internals as Internals2,
1175
1299
  Interactive,
@@ -1180,28 +1304,28 @@ import {
1180
1304
  import { NoReactInternals as NoReactInternals2 } from "remotion/no-react";
1181
1305
 
1182
1306
  // src/context.tsx
1183
- import React2, { useMemo as useMemo3 } from "react";
1184
- import { jsx as jsx3 } from "react/jsx-runtime";
1307
+ import React2, { useMemo as useMemo4 } from "react";
1308
+ import { jsx as jsx4 } from "react/jsx-runtime";
1185
1309
  var EnteringContext = React2.createContext(null);
1186
1310
  var ExitingContext = React2.createContext(null);
1187
1311
  var WrapInEnteringProgressContext = ({ presentationProgress, children }) => {
1188
- const value = useMemo3(() => {
1312
+ const value = useMemo4(() => {
1189
1313
  return {
1190
1314
  enteringProgress: presentationProgress
1191
1315
  };
1192
1316
  }, [presentationProgress]);
1193
- return /* @__PURE__ */ jsx3(EnteringContext.Provider, {
1317
+ return /* @__PURE__ */ jsx4(EnteringContext.Provider, {
1194
1318
  value,
1195
1319
  children
1196
1320
  });
1197
1321
  };
1198
1322
  var WrapInExitingProgressContext = ({ presentationProgress, children }) => {
1199
- const value = useMemo3(() => {
1323
+ const value = useMemo4(() => {
1200
1324
  return {
1201
1325
  exitingProgress: presentationProgress
1202
1326
  };
1203
1327
  }, [presentationProgress]);
1204
- return /* @__PURE__ */ jsx3(ExitingContext.Provider, {
1328
+ return /* @__PURE__ */ jsx4(ExitingContext.Provider, {
1205
1329
  value,
1206
1330
  children
1207
1331
  });
@@ -1225,15 +1349,14 @@ import { NoReactInternals } from "remotion/no-react";
1225
1349
  var validateDurationInFrames = NoReactInternals.validateDurationInFrames;
1226
1350
 
1227
1351
  // src/TransitionSeries.tsx
1228
- import { jsx as jsx4, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
1352
+ import { jsx as jsx5, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
1229
1353
  var { SequenceWithoutSchema } = Internals2;
1230
1354
  var TransitionSeriesTransitionInner = ({
1231
- stack = null,
1232
1355
  _remotionInternalRender = null,
1233
1356
  ...props
1234
1357
  }) => {
1235
1358
  if (_remotionInternalRender) {
1236
- return _remotionInternalRender({ ...props, stack });
1359
+ return _remotionInternalRender(props);
1237
1360
  }
1238
1361
  return null;
1239
1362
  };
@@ -1246,12 +1369,11 @@ var TransitionSeriesTransition = Interactive.withSchema({
1246
1369
  supportsEffects: false
1247
1370
  });
1248
1371
  var SeriesOverlayInner = ({
1249
- stack = null,
1250
1372
  _remotionInternalRender = null,
1251
1373
  ...props
1252
1374
  }) => {
1253
1375
  if (_remotionInternalRender) {
1254
- return _remotionInternalRender({ ...props, stack });
1376
+ return _remotionInternalRender(props);
1255
1377
  }
1256
1378
  return null;
1257
1379
  };
@@ -1275,7 +1397,6 @@ var transitionSeriesSequenceSchema = {
1275
1397
  var SeriesSequenceInner = ({
1276
1398
  offset = 0,
1277
1399
  className = "",
1278
- stack = null,
1279
1400
  _remotionInternalRender = null,
1280
1401
  ...props
1281
1402
  }) => {
@@ -1283,11 +1404,10 @@ var SeriesSequenceInner = ({
1283
1404
  return _remotionInternalRender({
1284
1405
  ...props,
1285
1406
  offset,
1286
- className: className || undefined,
1287
- stack
1407
+ className: className || undefined
1288
1408
  });
1289
1409
  }
1290
- return /* @__PURE__ */ jsx4(Fragment, {
1410
+ return /* @__PURE__ */ jsx5(Fragment, {
1291
1411
  children: props.children
1292
1412
  });
1293
1413
  };
@@ -1313,7 +1433,7 @@ var TransitionSeriesChildren = ({
1313
1433
  const frame = useCurrentFrame();
1314
1434
  const prevImageRef = useRef2({});
1315
1435
  const nextImageRef = useRef2({});
1316
- const flattedChildren = useMemo4(() => {
1436
+ const flattedChildren = useMemo5(() => {
1317
1437
  return flattenChildren(children);
1318
1438
  }, [children]);
1319
1439
  const drawIfSynced = useCallback2((index) => {
@@ -1342,7 +1462,7 @@ var TransitionSeriesChildren = ({
1342
1462
  nextImageRef.current[index] = { elementImage, progress, draw };
1343
1463
  drawIfSynced(index);
1344
1464
  }, [drawIfSynced]);
1345
- const childrenValue = useMemo4(() => {
1465
+ const childrenValue = useMemo5(() => {
1346
1466
  const renderChildren = (state) => {
1347
1467
  const {
1348
1468
  index: i,
@@ -1353,12 +1473,11 @@ var TransitionSeriesChildren = ({
1353
1473
  pendingOverlayValidation
1354
1474
  } = state;
1355
1475
  if (i === flattedChildren.length) {
1356
- return overlayRenders.map((info) => /* @__PURE__ */ jsx4(SequenceWithoutSchema, {
1476
+ return overlayRenders.map((info) => /* @__PURE__ */ jsx5(SequenceWithoutSchema, {
1357
1477
  from: Math.round(info.overlayFrom),
1358
1478
  durationInFrames: info.durationInFrames,
1359
1479
  name: "<TS.Overlay>",
1360
1480
  _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/transitions/transitionseries",
1361
- _remotionInternalStack: info.stack ?? undefined,
1362
1481
  controls: info.controls ?? undefined,
1363
1482
  layout: "absolute-fill",
1364
1483
  children: info.children
@@ -1428,8 +1547,7 @@ var TransitionSeriesChildren = ({
1428
1547
  halfDuration,
1429
1548
  children: overlayProps.children,
1430
1549
  index: i,
1431
- controls: overlayProps.controls,
1432
- stack: overlayProps.stack
1550
+ controls: overlayProps.controls
1433
1551
  };
1434
1552
  return renderNext({
1435
1553
  overlayRenders: [...overlayRenders, overlayRender],
@@ -1450,14 +1568,13 @@ var TransitionSeriesChildren = ({
1450
1568
  _remotionInternalRender: (transitionProps) => {
1451
1569
  const transitionDuration = transitionProps.timing.getDurationInFrames({ fps });
1452
1570
  const transitionFrom = startFrame + transitionOffsets - transitionDuration;
1453
- return /* @__PURE__ */ jsxs2(Fragment, {
1571
+ return /* @__PURE__ */ jsxs3(Fragment, {
1454
1572
  children: [
1455
- transitionDuration > 0 ? /* @__PURE__ */ jsx4(SequenceWithoutSchema, {
1573
+ transitionDuration > 0 ? /* @__PURE__ */ jsx5(SequenceWithoutSchema, {
1456
1574
  from: transitionFrom,
1457
1575
  durationInFrames: transitionDuration,
1458
1576
  name: "<TS.Transition>",
1459
1577
  _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/transitions/transitionseries",
1460
- _remotionInternalStack: transitionProps.stack ?? undefined,
1461
1578
  controls: transitionProps.controls ?? undefined,
1462
1579
  layout: "none"
1463
1580
  }) : null,
@@ -1482,10 +1599,13 @@ var TransitionSeriesChildren = ({
1482
1599
  children: sequenceChildren,
1483
1600
  offset: offsetProp,
1484
1601
  controls,
1485
- stack,
1486
1602
  from: _from,
1487
1603
  ...passedProps
1488
1604
  } = resolvedProps;
1605
+ const propsForSequence = {
1606
+ ...passedProps,
1607
+ _remotionInternalSingleChildComponent: Internals2.getSingleChildComponent(sequenceChildren)
1608
+ };
1489
1609
  validateDurationInFrames(durationInFramesProp, {
1490
1610
  component: `of a <TransitionSeries.Sequence /> component`,
1491
1611
  allowFloats: true
@@ -1533,7 +1653,7 @@ var TransitionSeriesChildren = ({
1533
1653
  }
1534
1654
  }
1535
1655
  const renderSequenceAndRest = (sequence) => {
1536
- return /* @__PURE__ */ jsxs2(Fragment, {
1656
+ return /* @__PURE__ */ jsxs3(Fragment, {
1537
1657
  children: [
1538
1658
  sequence,
1539
1659
  renderNext({
@@ -1564,15 +1684,14 @@ var TransitionSeriesChildren = ({
1564
1684
  const prevPresentation = prev.props.presentation ?? slide();
1565
1685
  const UppercaseNextPresentation = nextPresentation.component;
1566
1686
  const UppercasePrevPresentation = prevPresentation.component;
1567
- return renderSequenceAndRest(/* @__PURE__ */ jsx4(SequenceWithoutSchema, {
1687
+ return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
1568
1688
  from: actualStartFrame,
1569
1689
  durationInFrames: durationInFramesProp,
1570
- ...passedProps,
1690
+ ...propsForSequence,
1571
1691
  name: passedProps.name || "<TS.Sequence>",
1572
1692
  _remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
1573
- _remotionInternalStack: stack ?? undefined,
1574
1693
  controls: controls ?? undefined,
1575
- children: /* @__PURE__ */ jsx4(UppercaseNextPresentation, {
1694
+ children: /* @__PURE__ */ jsx5(UppercaseNextPresentation, {
1576
1695
  passedProps: nextPresentation.props ?? {},
1577
1696
  presentationDirection: "exiting",
1578
1697
  presentationProgress: nextProgress,
@@ -1584,9 +1703,9 @@ var TransitionSeriesChildren = ({
1584
1703
  throw new Error("Should not call when exiting");
1585
1704
  },
1586
1705
  bothEnteringAndExiting: true,
1587
- children: /* @__PURE__ */ jsx4(WrapInExitingProgressContext, {
1706
+ children: /* @__PURE__ */ jsx5(WrapInExitingProgressContext, {
1588
1707
  presentationProgress: nextProgress,
1589
- children: /* @__PURE__ */ jsx4(UppercasePrevPresentation, {
1708
+ children: /* @__PURE__ */ jsx5(UppercasePrevPresentation, {
1590
1709
  passedProps: prevPresentation.props ?? {},
1591
1710
  presentationDirection: "entering",
1592
1711
  presentationProgress: prevProgress,
@@ -1600,7 +1719,7 @@ var TransitionSeriesChildren = ({
1600
1719
  onNextElementImage(null, null, null, i - 1);
1601
1720
  },
1602
1721
  bothEnteringAndExiting: true,
1603
- children: /* @__PURE__ */ jsx4(WrapInEnteringProgressContext, {
1722
+ children: /* @__PURE__ */ jsx5(WrapInEnteringProgressContext, {
1604
1723
  presentationProgress: prevProgress,
1605
1724
  children: sequenceChildren
1606
1725
  })
@@ -1612,15 +1731,14 @@ var TransitionSeriesChildren = ({
1612
1731
  if (prevProgress !== null && prev) {
1613
1732
  const prevPresentation = prev.props.presentation ?? slide();
1614
1733
  const UppercasePrevPresentation = prevPresentation.component;
1615
- return renderSequenceAndRest(/* @__PURE__ */ jsx4(SequenceWithoutSchema, {
1734
+ return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
1616
1735
  from: actualStartFrame,
1617
1736
  durationInFrames: durationInFramesProp,
1618
- ...passedProps,
1737
+ ...propsForSequence,
1619
1738
  name: passedProps.name || "<TS.Sequence>",
1620
1739
  _remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
1621
- _remotionInternalStack: stack ?? undefined,
1622
1740
  controls: controls ?? undefined,
1623
- children: /* @__PURE__ */ jsx4(UppercasePrevPresentation, {
1741
+ children: /* @__PURE__ */ jsx5(UppercasePrevPresentation, {
1624
1742
  passedProps: prevPresentation.props ?? {},
1625
1743
  presentationDirection: "entering",
1626
1744
  presentationProgress: prevProgress,
@@ -1630,7 +1748,7 @@ var TransitionSeriesChildren = ({
1630
1748
  onNextElementImage(null, null, null, i - 1);
1631
1749
  },
1632
1750
  bothEnteringAndExiting: false,
1633
- children: /* @__PURE__ */ jsx4(WrapInEnteringProgressContext, {
1751
+ children: /* @__PURE__ */ jsx5(WrapInEnteringProgressContext, {
1634
1752
  presentationProgress: prevProgress,
1635
1753
  children: sequenceChildren
1636
1754
  })
@@ -1640,15 +1758,14 @@ var TransitionSeriesChildren = ({
1640
1758
  if (nextProgress !== null && next) {
1641
1759
  const nextPresentation = next.props.presentation ?? slide();
1642
1760
  const UppercaseNextPresentation = nextPresentation.component;
1643
- return renderSequenceAndRest(/* @__PURE__ */ jsx4(SequenceWithoutSchema, {
1761
+ return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
1644
1762
  from: actualStartFrame,
1645
1763
  durationInFrames: durationInFramesProp,
1646
- ...passedProps,
1764
+ ...propsForSequence,
1647
1765
  name: passedProps.name || "<TS.Sequence>",
1648
1766
  _remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
1649
- _remotionInternalStack: stack ?? undefined,
1650
1767
  controls: controls ?? undefined,
1651
- children: /* @__PURE__ */ jsx4(UppercaseNextPresentation, {
1768
+ children: /* @__PURE__ */ jsx5(UppercaseNextPresentation, {
1652
1769
  passedProps: nextPresentation.props ?? {},
1653
1770
  presentationDirection: "exiting",
1654
1771
  presentationProgress: nextProgress,
@@ -1658,20 +1775,19 @@ var TransitionSeriesChildren = ({
1658
1775
  onPrevElementImage(null, null, null, i + 1);
1659
1776
  },
1660
1777
  bothEnteringAndExiting: false,
1661
- children: /* @__PURE__ */ jsx4(WrapInExitingProgressContext, {
1778
+ children: /* @__PURE__ */ jsx5(WrapInExitingProgressContext, {
1662
1779
  presentationProgress: nextProgress,
1663
1780
  children: sequenceChildren
1664
1781
  })
1665
1782
  })
1666
1783
  }, i));
1667
1784
  }
1668
- return renderSequenceAndRest(/* @__PURE__ */ jsx4(SequenceWithoutSchema, {
1785
+ return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
1669
1786
  from: actualStartFrame,
1670
1787
  durationInFrames: durationInFramesProp,
1671
- ...passedProps,
1788
+ ...propsForSequence,
1672
1789
  name: passedProps.name || "<TS.Sequence>",
1673
1790
  _remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
1674
- _remotionInternalStack: stack ?? undefined,
1675
1791
  controls: controls ?? undefined,
1676
1792
  children: sequenceChildren
1677
1793
  }, i));
@@ -1687,7 +1803,7 @@ var TransitionSeriesChildren = ({
1687
1803
  pendingOverlayValidation: false
1688
1804
  });
1689
1805
  }, [flattedChildren, fps, frame, onPrevElementImage, onNextElementImage]);
1690
- return /* @__PURE__ */ jsx4(Fragment, {
1806
+ return /* @__PURE__ */ jsx5(Fragment, {
1691
1807
  children: childrenValue
1692
1808
  });
1693
1809
  };
@@ -1699,20 +1815,18 @@ var TransitionSeriesInner = (props) => {
1699
1815
  controls,
1700
1816
  ...otherProps
1701
1817
  } = props;
1702
- const { stack, ...propsForSequence } = otherProps;
1703
1818
  const displayName = name ?? "<TransitionSeries>";
1704
1819
  const layout = passedLayout ?? "absolute-fill";
1705
1820
  if (NoReactInternals2.ENABLE_V5_BREAKING_CHANGES && layout !== "absolute-fill") {
1706
1821
  throw new TypeError(`The "layout" prop of <TransitionSeries /> is not supported anymore in v5. TransitionSeries' must be absolutely positioned.`);
1707
1822
  }
1708
- return /* @__PURE__ */ jsx4(Sequence, {
1823
+ return /* @__PURE__ */ jsx5(Sequence, {
1709
1824
  name: displayName,
1710
1825
  layout,
1711
1826
  _remotionInternalDocumentationLink: name === undefined ? "https://www.remotion.dev/docs/transitions/transitionseries" : undefined,
1712
- ...propsForSequence,
1713
- _remotionInternalStack: stack ?? undefined,
1827
+ ...otherProps,
1714
1828
  controls: controls ?? undefined,
1715
- children: /* @__PURE__ */ jsx4(TransitionSeriesChildren, {
1829
+ children: /* @__PURE__ */ jsx5(TransitionSeriesChildren, {
1716
1830
  children
1717
1831
  })
1718
1832
  });
@@ -1748,6 +1862,7 @@ var useTransitionProgress = () => {
1748
1862
  export {
1749
1863
  useTransitionProgress,
1750
1864
  springTiming,
1865
+ pushCut,
1751
1866
  makeHtmlInCanvasPresentation,
1752
1867
  linearTiming,
1753
1868
  linearBlur,
@@ -0,0 +1,126 @@
1
+ // src/presentations/push-cut.tsx
2
+ import { useMemo } from "react";
3
+ import { AbsoluteFill, Easing, interpolate } from "remotion";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var clamp = {
6
+ extrapolateLeft: "clamp",
7
+ extrapolateRight: "clamp"
8
+ };
9
+ var validateFiniteNumber = (name, value) => {
10
+ if (!Number.isFinite(value)) {
11
+ throw new TypeError(`${name} passed to pushCut() must be finite, received ${value}`);
12
+ }
13
+ };
14
+ var validateProps = (props) => {
15
+ const cutProgress = props.cutProgress ?? 5 / 11;
16
+ const outgoingScale = props.outgoingScale ?? 1.04;
17
+ const incomingStartScale = props.incomingStartScale ?? 1.04;
18
+ const incomingEndScale = props.incomingEndScale ?? 1.07;
19
+ const flashOpacity = props.flashOpacity ?? 0.2;
20
+ const flashFrames = props.flashFrames ?? 2;
21
+ validateFiniteNumber("cutProgress", cutProgress);
22
+ if (cutProgress <= 0 || cutProgress >= 1) {
23
+ throw new TypeError(`cutProgress passed to pushCut() must be greater than 0 and less than 1, received ${cutProgress}`);
24
+ }
25
+ for (const [name, value] of [
26
+ ["outgoingScale", outgoingScale],
27
+ ["incomingStartScale", incomingStartScale],
28
+ ["incomingEndScale", incomingEndScale]
29
+ ]) {
30
+ validateFiniteNumber(name, value);
31
+ if (value <= 0) {
32
+ throw new TypeError(`${name} passed to pushCut() must be greater than 0, received ${value}`);
33
+ }
34
+ }
35
+ validateFiniteNumber("flashOpacity", flashOpacity);
36
+ if (flashOpacity < 0 || flashOpacity > 1) {
37
+ throw new TypeError(`flashOpacity passed to pushCut() must be between 0 and 1, received ${flashOpacity}`);
38
+ }
39
+ validateFiniteNumber("flashFrames", flashFrames);
40
+ if (flashFrames < 0) {
41
+ throw new TypeError(`flashFrames passed to pushCut() must be greater than or equal to 0, received ${flashFrames}`);
42
+ }
43
+ };
44
+ var PushCutPresentation = ({
45
+ children,
46
+ presentationDirection,
47
+ presentationDurationInFrames,
48
+ presentationProgress,
49
+ passedProps
50
+ }) => {
51
+ const {
52
+ cutProgress = 5 / 11,
53
+ outgoingScale = 1.04,
54
+ incomingStartScale = 1.04,
55
+ incomingEndScale = 1.07,
56
+ transformOrigin = "50% 50%",
57
+ flashColor = "#f5f2ed",
58
+ flashOpacity: peakFlashOpacity = 0.2,
59
+ flashFrames = 2,
60
+ outerEnterStyle,
61
+ outerExitStyle,
62
+ innerEnterStyle,
63
+ innerExitStyle
64
+ } = passedProps;
65
+ const isEntering = presentationDirection === "entering";
66
+ const outgoingProgress = interpolate(presentationProgress, [0, cutProgress], [0, 1], {
67
+ ...clamp,
68
+ easing: Easing.in(Easing.quad)
69
+ });
70
+ const incomingProgress = interpolate(presentationProgress, [cutProgress, 1], [0, 1], {
71
+ ...clamp,
72
+ easing: Easing.out(Easing.quad)
73
+ });
74
+ const scale = isEntering ? interpolate(incomingProgress, [0, 1], [incomingStartScale, incomingEndScale]) : interpolate(outgoingProgress, [0, 1], [1, outgoingScale]);
75
+ const oneFrame = 1 / Math.max(1, presentationDurationInFrames);
76
+ const flashTail = flashFrames / Math.max(1, presentationDurationInFrames);
77
+ const flashOpacity = isEntering ? interpolate(presentationProgress, [cutProgress, cutProgress + flashTail], [peakFlashOpacity, 0], clamp) : interpolate(presentationProgress, [cutProgress - oneFrame, cutProgress], [0, peakFlashOpacity], clamp);
78
+ const outerStyle = useMemo(() => {
79
+ return {
80
+ opacity: isEntering && presentationProgress < cutProgress ? 0 : 1,
81
+ overflow: "hidden",
82
+ ...isEntering ? outerEnterStyle : outerExitStyle
83
+ };
84
+ }, [
85
+ cutProgress,
86
+ isEntering,
87
+ outerEnterStyle,
88
+ outerExitStyle,
89
+ presentationProgress
90
+ ]);
91
+ const innerStyle = useMemo(() => {
92
+ return {
93
+ transform: `scale(${scale})`,
94
+ transformOrigin,
95
+ willChange: "transform",
96
+ ...isEntering ? innerEnterStyle : innerExitStyle
97
+ };
98
+ }, [innerEnterStyle, innerExitStyle, isEntering, scale, transformOrigin]);
99
+ return /* @__PURE__ */ jsxs(AbsoluteFill, {
100
+ style: outerStyle,
101
+ children: [
102
+ /* @__PURE__ */ jsx(AbsoluteFill, {
103
+ style: innerStyle,
104
+ children
105
+ }),
106
+ flashOpacity > 0 ? /* @__PURE__ */ jsx(AbsoluteFill, {
107
+ style: {
108
+ backgroundColor: flashColor,
109
+ opacity: flashOpacity,
110
+ pointerEvents: "none"
111
+ }
112
+ }) : null
113
+ ]
114
+ });
115
+ };
116
+ var pushCut = (props) => {
117
+ const passedProps = props ?? {};
118
+ validateProps(passedProps);
119
+ return {
120
+ component: PushCutPresentation,
121
+ props: passedProps
122
+ };
123
+ };
124
+ export {
125
+ pushCut
126
+ };
package/dist/index.d.ts CHANGED
@@ -14,3 +14,5 @@ export { filmBurn } from './presentations/film-burn.js';
14
14
  export type { FilmBurnProps } from './presentations/film-burn.js';
15
15
  export { linearBlur } from './presentations/linear-blur.js';
16
16
  export type { LinearBlurProps } from './presentations/linear-blur.js';
17
+ export { pushCut } from './presentations/push-cut.js';
18
+ export type { PushCutProps } from './presentations/push-cut.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.linearBlur = exports.filmBurn = exports.dreamyZoom = exports.crossZoom = exports.makeHtmlInCanvasPresentation = exports.useTransitionProgress = exports.TransitionSeries = exports.springTiming = exports.linearTiming = void 0;
3
+ exports.pushCut = exports.linearBlur = exports.filmBurn = exports.dreamyZoom = exports.crossZoom = exports.makeHtmlInCanvasPresentation = exports.useTransitionProgress = exports.TransitionSeries = exports.springTiming = exports.linearTiming = void 0;
4
4
  // Timings
5
5
  const linear_timing_js_1 = require("./timings/linear-timing.js");
6
6
  Object.defineProperty(exports, "linearTiming", { enumerable: true, get: function () { return linear_timing_js_1.linearTiming; } });
@@ -23,3 +23,5 @@ const film_burn_js_1 = require("./presentations/film-burn.js");
23
23
  Object.defineProperty(exports, "filmBurn", { enumerable: true, get: function () { return film_burn_js_1.filmBurn; } });
24
24
  const linear_blur_js_1 = require("./presentations/linear-blur.js");
25
25
  Object.defineProperty(exports, "linearBlur", { enumerable: true, get: function () { return linear_blur_js_1.linearBlur; } });
26
+ const push_cut_js_1 = require("./presentations/push-cut.js");
27
+ Object.defineProperty(exports, "pushCut", { enumerable: true, get: function () { return push_cut_js_1.pushCut; } });
@@ -0,0 +1,17 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { TransitionPresentation } from '../types.js';
3
+ export type PushCutProps = {
4
+ cutProgress?: number;
5
+ outgoingScale?: number;
6
+ incomingStartScale?: number;
7
+ incomingEndScale?: number;
8
+ transformOrigin?: CSSProperties['transformOrigin'];
9
+ flashColor?: string;
10
+ flashOpacity?: number;
11
+ flashFrames?: number;
12
+ outerEnterStyle?: CSSProperties;
13
+ outerExitStyle?: CSSProperties;
14
+ innerEnterStyle?: CSSProperties;
15
+ innerExitStyle?: CSSProperties;
16
+ };
17
+ export declare const pushCut: (props?: PushCutProps | undefined) => TransitionPresentation<PushCutProps>;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pushCut = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const clamp = {
8
+ extrapolateLeft: 'clamp',
9
+ extrapolateRight: 'clamp',
10
+ };
11
+ const validateFiniteNumber = (name, value) => {
12
+ if (!Number.isFinite(value)) {
13
+ throw new TypeError(`${name} passed to pushCut() must be finite, received ${value}`);
14
+ }
15
+ };
16
+ const validateProps = (props) => {
17
+ var _a, _b, _c, _d, _e, _f;
18
+ const cutProgress = (_a = props.cutProgress) !== null && _a !== void 0 ? _a : 5 / 11;
19
+ const outgoingScale = (_b = props.outgoingScale) !== null && _b !== void 0 ? _b : 1.04;
20
+ const incomingStartScale = (_c = props.incomingStartScale) !== null && _c !== void 0 ? _c : 1.04;
21
+ const incomingEndScale = (_d = props.incomingEndScale) !== null && _d !== void 0 ? _d : 1.07;
22
+ const flashOpacity = (_e = props.flashOpacity) !== null && _e !== void 0 ? _e : 0.2;
23
+ const flashFrames = (_f = props.flashFrames) !== null && _f !== void 0 ? _f : 2;
24
+ validateFiniteNumber('cutProgress', cutProgress);
25
+ if (cutProgress <= 0 || cutProgress >= 1) {
26
+ throw new TypeError(`cutProgress passed to pushCut() must be greater than 0 and less than 1, received ${cutProgress}`);
27
+ }
28
+ for (const [name, value] of [
29
+ ['outgoingScale', outgoingScale],
30
+ ['incomingStartScale', incomingStartScale],
31
+ ['incomingEndScale', incomingEndScale],
32
+ ]) {
33
+ validateFiniteNumber(name, value);
34
+ if (value <= 0) {
35
+ throw new TypeError(`${name} passed to pushCut() must be greater than 0, received ${value}`);
36
+ }
37
+ }
38
+ validateFiniteNumber('flashOpacity', flashOpacity);
39
+ if (flashOpacity < 0 || flashOpacity > 1) {
40
+ throw new TypeError(`flashOpacity passed to pushCut() must be between 0 and 1, received ${flashOpacity}`);
41
+ }
42
+ validateFiniteNumber('flashFrames', flashFrames);
43
+ if (flashFrames < 0) {
44
+ throw new TypeError(`flashFrames passed to pushCut() must be greater than or equal to 0, received ${flashFrames}`);
45
+ }
46
+ };
47
+ const PushCutPresentation = ({ children, presentationDirection, presentationDurationInFrames, presentationProgress, passedProps, }) => {
48
+ const { cutProgress = 5 / 11, outgoingScale = 1.04, incomingStartScale = 1.04, incomingEndScale = 1.07, transformOrigin = '50% 50%', flashColor = '#f5f2ed', flashOpacity: peakFlashOpacity = 0.2, flashFrames = 2, outerEnterStyle, outerExitStyle, innerEnterStyle, innerExitStyle, } = passedProps;
49
+ const isEntering = presentationDirection === 'entering';
50
+ const outgoingProgress = (0, remotion_1.interpolate)(presentationProgress, [0, cutProgress], [0, 1], {
51
+ ...clamp,
52
+ easing: remotion_1.Easing.in(remotion_1.Easing.quad),
53
+ });
54
+ const incomingProgress = (0, remotion_1.interpolate)(presentationProgress, [cutProgress, 1], [0, 1], {
55
+ ...clamp,
56
+ easing: remotion_1.Easing.out(remotion_1.Easing.quad),
57
+ });
58
+ const scale = isEntering
59
+ ? (0, remotion_1.interpolate)(incomingProgress, [0, 1], [incomingStartScale, incomingEndScale])
60
+ : (0, remotion_1.interpolate)(outgoingProgress, [0, 1], [1, outgoingScale]);
61
+ const oneFrame = 1 / Math.max(1, presentationDurationInFrames);
62
+ const flashTail = flashFrames / Math.max(1, presentationDurationInFrames);
63
+ const flashOpacity = isEntering
64
+ ? (0, remotion_1.interpolate)(presentationProgress, [cutProgress, cutProgress + flashTail], [peakFlashOpacity, 0], clamp)
65
+ : (0, remotion_1.interpolate)(presentationProgress, [cutProgress - oneFrame, cutProgress], [0, peakFlashOpacity], clamp);
66
+ const outerStyle = (0, react_1.useMemo)(() => {
67
+ return {
68
+ opacity: isEntering && presentationProgress < cutProgress ? 0 : 1,
69
+ overflow: 'hidden',
70
+ ...(isEntering ? outerEnterStyle : outerExitStyle),
71
+ };
72
+ }, [
73
+ cutProgress,
74
+ isEntering,
75
+ outerEnterStyle,
76
+ outerExitStyle,
77
+ presentationProgress,
78
+ ]);
79
+ const innerStyle = (0, react_1.useMemo)(() => {
80
+ return {
81
+ transform: `scale(${scale})`,
82
+ transformOrigin,
83
+ willChange: 'transform',
84
+ ...(isEntering ? innerEnterStyle : innerExitStyle),
85
+ };
86
+ }, [innerEnterStyle, innerExitStyle, isEntering, scale, transformOrigin]);
87
+ return (jsx_runtime_1.jsxs(remotion_1.AbsoluteFill, { style: outerStyle, children: [
88
+ jsx_runtime_1.jsx(remotion_1.AbsoluteFill, { style: innerStyle, children: children }), flashOpacity > 0 ? (jsx_runtime_1.jsx(remotion_1.AbsoluteFill, { style: {
89
+ backgroundColor: flashColor,
90
+ opacity: flashOpacity,
91
+ pointerEvents: 'none',
92
+ } })) : null] }));
93
+ };
94
+ /*
95
+ * Created by Tom Vaillant: https://github.com/tomvaillant
96
+ * @description A hard editorial cut with a short punch-in on both scenes and a brief flash at the edit point.
97
+ * @see [Documentation](https://www.remotion.dev/docs/transitions/presentations/push-cut)
98
+ */
99
+ const pushCut = (props) => {
100
+ const passedProps = props !== null && props !== void 0 ? props : {};
101
+ validateProps(passedProps);
102
+ return {
103
+ component: PushCutPresentation,
104
+ props: passedProps,
105
+ };
106
+ };
107
+ exports.pushCut = pushCut;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/transitions"
4
4
  },
5
5
  "name": "@remotion/transitions",
6
- "version": "4.0.499",
6
+ "version": "4.0.501",
7
7
  "description": "Library for creating transitions in Remotion",
8
8
  "main": "dist/esm/index.mjs",
9
9
  "module": "dist/esm/index.js",
@@ -22,18 +22,18 @@
22
22
  "url": "https://github.com/remotion-dev/remotion/issues"
23
23
  },
24
24
  "dependencies": {
25
- "remotion": "4.0.499",
26
- "@remotion/shapes": "4.0.499",
27
- "@remotion/paths": "4.0.499"
25
+ "remotion": "4.0.501",
26
+ "@remotion/shapes": "4.0.501",
27
+ "@remotion/paths": "4.0.501"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@happy-dom/global-registrator": "14.5.1",
31
- "remotion": "4.0.499",
31
+ "remotion": "4.0.501",
32
32
  "react": "19.2.3",
33
33
  "react-dom": "19.2.3",
34
- "@remotion/test-utils": "4.0.499",
35
- "@remotion/player": "4.0.499",
36
- "@remotion/eslint-config-internal": "4.0.499",
34
+ "@remotion/test-utils": "4.0.501",
35
+ "@remotion/player": "4.0.501",
36
+ "@remotion/eslint-config-internal": "4.0.501",
37
37
  "eslint": "9.19.0",
38
38
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
39
39
  },
@@ -163,6 +163,12 @@
163
163
  "import": "./dist/esm/swap.mjs",
164
164
  "require": "./dist/presentations/swap.js"
165
165
  },
166
+ "./push-cut": {
167
+ "types": "./dist/presentations/push-cut.d.ts",
168
+ "module": "./dist/esm/push-cut.mjs",
169
+ "import": "./dist/esm/push-cut.mjs",
170
+ "require": "./dist/presentations/push-cut.js"
171
+ },
166
172
  "./package.json": "./package.json"
167
173
  },
168
174
  "typesVersions": {
@@ -220,6 +226,9 @@
220
226
  ],
221
227
  "swap": [
222
228
  "dist/presentations/swap.d.ts"
229
+ ],
230
+ "push-cut": [
231
+ "dist/presentations/push-cut.d.ts"
223
232
  ]
224
233
  }
225
234
  },
package/push-cut.js ADDED
@@ -0,0 +1,2 @@
1
+ // For backwards compatibility when you use `esm-wallaby`
2
+ module.exports = require('./dist/presentations/push-cut.js');