@remotion/transitions 4.0.498 → 4.0.500
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.mjs +157 -32
- package/dist/esm/push-cut.mjs +126 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/presentations/push-cut.d.ts +17 -0
- package/dist/presentations/push-cut.js +107 -0
- package/package.json +17 -8
- package/push-cut.js +2 -0
package/dist/esm/index.mjs
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
1184
|
-
import { jsx as
|
|
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 =
|
|
1312
|
+
const value = useMemo4(() => {
|
|
1189
1313
|
return {
|
|
1190
1314
|
enteringProgress: presentationProgress
|
|
1191
1315
|
};
|
|
1192
1316
|
}, [presentationProgress]);
|
|
1193
|
-
return /* @__PURE__ */
|
|
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 =
|
|
1323
|
+
const value = useMemo4(() => {
|
|
1200
1324
|
return {
|
|
1201
1325
|
exitingProgress: presentationProgress
|
|
1202
1326
|
};
|
|
1203
1327
|
}, [presentationProgress]);
|
|
1204
|
-
return /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ jsx4(ExitingContext.Provider, {
|
|
1205
1329
|
value,
|
|
1206
1330
|
children
|
|
1207
1331
|
});
|
|
@@ -1225,7 +1349,7 @@ import { NoReactInternals } from "remotion/no-react";
|
|
|
1225
1349
|
var validateDurationInFrames = NoReactInternals.validateDurationInFrames;
|
|
1226
1350
|
|
|
1227
1351
|
// src/TransitionSeries.tsx
|
|
1228
|
-
import { jsx as
|
|
1352
|
+
import { jsx as jsx5, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
1229
1353
|
var { SequenceWithoutSchema } = Internals2;
|
|
1230
1354
|
var TransitionSeriesTransitionInner = ({
|
|
1231
1355
|
stack = null,
|
|
@@ -1287,7 +1411,7 @@ var SeriesSequenceInner = ({
|
|
|
1287
1411
|
stack
|
|
1288
1412
|
});
|
|
1289
1413
|
}
|
|
1290
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsx5(Fragment, {
|
|
1291
1415
|
children: props.children
|
|
1292
1416
|
});
|
|
1293
1417
|
};
|
|
@@ -1313,7 +1437,7 @@ var TransitionSeriesChildren = ({
|
|
|
1313
1437
|
const frame = useCurrentFrame();
|
|
1314
1438
|
const prevImageRef = useRef2({});
|
|
1315
1439
|
const nextImageRef = useRef2({});
|
|
1316
|
-
const flattedChildren =
|
|
1440
|
+
const flattedChildren = useMemo5(() => {
|
|
1317
1441
|
return flattenChildren(children);
|
|
1318
1442
|
}, [children]);
|
|
1319
1443
|
const drawIfSynced = useCallback2((index) => {
|
|
@@ -1342,7 +1466,7 @@ var TransitionSeriesChildren = ({
|
|
|
1342
1466
|
nextImageRef.current[index] = { elementImage, progress, draw };
|
|
1343
1467
|
drawIfSynced(index);
|
|
1344
1468
|
}, [drawIfSynced]);
|
|
1345
|
-
const childrenValue =
|
|
1469
|
+
const childrenValue = useMemo5(() => {
|
|
1346
1470
|
const renderChildren = (state) => {
|
|
1347
1471
|
const {
|
|
1348
1472
|
index: i,
|
|
@@ -1353,7 +1477,7 @@ var TransitionSeriesChildren = ({
|
|
|
1353
1477
|
pendingOverlayValidation
|
|
1354
1478
|
} = state;
|
|
1355
1479
|
if (i === flattedChildren.length) {
|
|
1356
|
-
return overlayRenders.map((info) => /* @__PURE__ */
|
|
1480
|
+
return overlayRenders.map((info) => /* @__PURE__ */ jsx5(SequenceWithoutSchema, {
|
|
1357
1481
|
from: Math.round(info.overlayFrom),
|
|
1358
1482
|
durationInFrames: info.durationInFrames,
|
|
1359
1483
|
name: "<TS.Overlay>",
|
|
@@ -1450,9 +1574,9 @@ var TransitionSeriesChildren = ({
|
|
|
1450
1574
|
_remotionInternalRender: (transitionProps) => {
|
|
1451
1575
|
const transitionDuration = transitionProps.timing.getDurationInFrames({ fps });
|
|
1452
1576
|
const transitionFrom = startFrame + transitionOffsets - transitionDuration;
|
|
1453
|
-
return /* @__PURE__ */
|
|
1577
|
+
return /* @__PURE__ */ jsxs3(Fragment, {
|
|
1454
1578
|
children: [
|
|
1455
|
-
transitionDuration > 0 ? /* @__PURE__ */
|
|
1579
|
+
transitionDuration > 0 ? /* @__PURE__ */ jsx5(SequenceWithoutSchema, {
|
|
1456
1580
|
from: transitionFrom,
|
|
1457
1581
|
durationInFrames: transitionDuration,
|
|
1458
1582
|
name: "<TS.Transition>",
|
|
@@ -1533,7 +1657,7 @@ var TransitionSeriesChildren = ({
|
|
|
1533
1657
|
}
|
|
1534
1658
|
}
|
|
1535
1659
|
const renderSequenceAndRest = (sequence) => {
|
|
1536
|
-
return /* @__PURE__ */
|
|
1660
|
+
return /* @__PURE__ */ jsxs3(Fragment, {
|
|
1537
1661
|
children: [
|
|
1538
1662
|
sequence,
|
|
1539
1663
|
renderNext({
|
|
@@ -1564,7 +1688,7 @@ var TransitionSeriesChildren = ({
|
|
|
1564
1688
|
const prevPresentation = prev.props.presentation ?? slide();
|
|
1565
1689
|
const UppercaseNextPresentation = nextPresentation.component;
|
|
1566
1690
|
const UppercasePrevPresentation = prevPresentation.component;
|
|
1567
|
-
return renderSequenceAndRest(/* @__PURE__ */
|
|
1691
|
+
return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
|
|
1568
1692
|
from: actualStartFrame,
|
|
1569
1693
|
durationInFrames: durationInFramesProp,
|
|
1570
1694
|
...passedProps,
|
|
@@ -1572,7 +1696,7 @@ var TransitionSeriesChildren = ({
|
|
|
1572
1696
|
_remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
|
|
1573
1697
|
_remotionInternalStack: stack ?? undefined,
|
|
1574
1698
|
controls: controls ?? undefined,
|
|
1575
|
-
children: /* @__PURE__ */
|
|
1699
|
+
children: /* @__PURE__ */ jsx5(UppercaseNextPresentation, {
|
|
1576
1700
|
passedProps: nextPresentation.props ?? {},
|
|
1577
1701
|
presentationDirection: "exiting",
|
|
1578
1702
|
presentationProgress: nextProgress,
|
|
@@ -1584,9 +1708,9 @@ var TransitionSeriesChildren = ({
|
|
|
1584
1708
|
throw new Error("Should not call when exiting");
|
|
1585
1709
|
},
|
|
1586
1710
|
bothEnteringAndExiting: true,
|
|
1587
|
-
children: /* @__PURE__ */
|
|
1711
|
+
children: /* @__PURE__ */ jsx5(WrapInExitingProgressContext, {
|
|
1588
1712
|
presentationProgress: nextProgress,
|
|
1589
|
-
children: /* @__PURE__ */
|
|
1713
|
+
children: /* @__PURE__ */ jsx5(UppercasePrevPresentation, {
|
|
1590
1714
|
passedProps: prevPresentation.props ?? {},
|
|
1591
1715
|
presentationDirection: "entering",
|
|
1592
1716
|
presentationProgress: prevProgress,
|
|
@@ -1600,7 +1724,7 @@ var TransitionSeriesChildren = ({
|
|
|
1600
1724
|
onNextElementImage(null, null, null, i - 1);
|
|
1601
1725
|
},
|
|
1602
1726
|
bothEnteringAndExiting: true,
|
|
1603
|
-
children: /* @__PURE__ */
|
|
1727
|
+
children: /* @__PURE__ */ jsx5(WrapInEnteringProgressContext, {
|
|
1604
1728
|
presentationProgress: prevProgress,
|
|
1605
1729
|
children: sequenceChildren
|
|
1606
1730
|
})
|
|
@@ -1612,7 +1736,7 @@ var TransitionSeriesChildren = ({
|
|
|
1612
1736
|
if (prevProgress !== null && prev) {
|
|
1613
1737
|
const prevPresentation = prev.props.presentation ?? slide();
|
|
1614
1738
|
const UppercasePrevPresentation = prevPresentation.component;
|
|
1615
|
-
return renderSequenceAndRest(/* @__PURE__ */
|
|
1739
|
+
return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
|
|
1616
1740
|
from: actualStartFrame,
|
|
1617
1741
|
durationInFrames: durationInFramesProp,
|
|
1618
1742
|
...passedProps,
|
|
@@ -1620,7 +1744,7 @@ var TransitionSeriesChildren = ({
|
|
|
1620
1744
|
_remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
|
|
1621
1745
|
_remotionInternalStack: stack ?? undefined,
|
|
1622
1746
|
controls: controls ?? undefined,
|
|
1623
|
-
children: /* @__PURE__ */
|
|
1747
|
+
children: /* @__PURE__ */ jsx5(UppercasePrevPresentation, {
|
|
1624
1748
|
passedProps: prevPresentation.props ?? {},
|
|
1625
1749
|
presentationDirection: "entering",
|
|
1626
1750
|
presentationProgress: prevProgress,
|
|
@@ -1630,7 +1754,7 @@ var TransitionSeriesChildren = ({
|
|
|
1630
1754
|
onNextElementImage(null, null, null, i - 1);
|
|
1631
1755
|
},
|
|
1632
1756
|
bothEnteringAndExiting: false,
|
|
1633
|
-
children: /* @__PURE__ */
|
|
1757
|
+
children: /* @__PURE__ */ jsx5(WrapInEnteringProgressContext, {
|
|
1634
1758
|
presentationProgress: prevProgress,
|
|
1635
1759
|
children: sequenceChildren
|
|
1636
1760
|
})
|
|
@@ -1640,7 +1764,7 @@ var TransitionSeriesChildren = ({
|
|
|
1640
1764
|
if (nextProgress !== null && next) {
|
|
1641
1765
|
const nextPresentation = next.props.presentation ?? slide();
|
|
1642
1766
|
const UppercaseNextPresentation = nextPresentation.component;
|
|
1643
|
-
return renderSequenceAndRest(/* @__PURE__ */
|
|
1767
|
+
return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
|
|
1644
1768
|
from: actualStartFrame,
|
|
1645
1769
|
durationInFrames: durationInFramesProp,
|
|
1646
1770
|
...passedProps,
|
|
@@ -1648,7 +1772,7 @@ var TransitionSeriesChildren = ({
|
|
|
1648
1772
|
_remotionInternalDocumentationLink: passedProps.name ? undefined : "https://www.remotion.dev/docs/transitions/transitionseries",
|
|
1649
1773
|
_remotionInternalStack: stack ?? undefined,
|
|
1650
1774
|
controls: controls ?? undefined,
|
|
1651
|
-
children: /* @__PURE__ */
|
|
1775
|
+
children: /* @__PURE__ */ jsx5(UppercaseNextPresentation, {
|
|
1652
1776
|
passedProps: nextPresentation.props ?? {},
|
|
1653
1777
|
presentationDirection: "exiting",
|
|
1654
1778
|
presentationProgress: nextProgress,
|
|
@@ -1658,14 +1782,14 @@ var TransitionSeriesChildren = ({
|
|
|
1658
1782
|
onPrevElementImage(null, null, null, i + 1);
|
|
1659
1783
|
},
|
|
1660
1784
|
bothEnteringAndExiting: false,
|
|
1661
|
-
children: /* @__PURE__ */
|
|
1785
|
+
children: /* @__PURE__ */ jsx5(WrapInExitingProgressContext, {
|
|
1662
1786
|
presentationProgress: nextProgress,
|
|
1663
1787
|
children: sequenceChildren
|
|
1664
1788
|
})
|
|
1665
1789
|
})
|
|
1666
1790
|
}, i));
|
|
1667
1791
|
}
|
|
1668
|
-
return renderSequenceAndRest(/* @__PURE__ */
|
|
1792
|
+
return renderSequenceAndRest(/* @__PURE__ */ jsx5(SequenceWithoutSchema, {
|
|
1669
1793
|
from: actualStartFrame,
|
|
1670
1794
|
durationInFrames: durationInFramesProp,
|
|
1671
1795
|
...passedProps,
|
|
@@ -1687,7 +1811,7 @@ var TransitionSeriesChildren = ({
|
|
|
1687
1811
|
pendingOverlayValidation: false
|
|
1688
1812
|
});
|
|
1689
1813
|
}, [flattedChildren, fps, frame, onPrevElementImage, onNextElementImage]);
|
|
1690
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ jsx5(Fragment, {
|
|
1691
1815
|
children: childrenValue
|
|
1692
1816
|
});
|
|
1693
1817
|
};
|
|
@@ -1705,14 +1829,14 @@ var TransitionSeriesInner = (props) => {
|
|
|
1705
1829
|
if (NoReactInternals2.ENABLE_V5_BREAKING_CHANGES && layout !== "absolute-fill") {
|
|
1706
1830
|
throw new TypeError(`The "layout" prop of <TransitionSeries /> is not supported anymore in v5. TransitionSeries' must be absolutely positioned.`);
|
|
1707
1831
|
}
|
|
1708
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsx5(Sequence, {
|
|
1709
1833
|
name: displayName,
|
|
1710
1834
|
layout,
|
|
1711
1835
|
_remotionInternalDocumentationLink: name === undefined ? "https://www.remotion.dev/docs/transitions/transitionseries" : undefined,
|
|
1712
1836
|
...propsForSequence,
|
|
1713
1837
|
_remotionInternalStack: stack ?? undefined,
|
|
1714
1838
|
controls: controls ?? undefined,
|
|
1715
|
-
children: /* @__PURE__ */
|
|
1839
|
+
children: /* @__PURE__ */ jsx5(TransitionSeriesChildren, {
|
|
1716
1840
|
children
|
|
1717
1841
|
})
|
|
1718
1842
|
});
|
|
@@ -1748,6 +1872,7 @@ var useTransitionProgress = () => {
|
|
|
1748
1872
|
export {
|
|
1749
1873
|
useTransitionProgress,
|
|
1750
1874
|
springTiming,
|
|
1875
|
+
pushCut,
|
|
1751
1876
|
makeHtmlInCanvasPresentation,
|
|
1752
1877
|
linearTiming,
|
|
1753
1878
|
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.
|
|
6
|
+
"version": "4.0.500",
|
|
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.
|
|
26
|
-
"@remotion/shapes": "4.0.
|
|
27
|
-
"@remotion/paths": "4.0.
|
|
25
|
+
"remotion": "4.0.500",
|
|
26
|
+
"@remotion/shapes": "4.0.500",
|
|
27
|
+
"@remotion/paths": "4.0.500"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@happy-dom/global-registrator": "14.5.1",
|
|
31
|
-
"remotion": "4.0.
|
|
31
|
+
"remotion": "4.0.500",
|
|
32
32
|
"react": "19.2.3",
|
|
33
33
|
"react-dom": "19.2.3",
|
|
34
|
-
"@remotion/test-utils": "4.0.
|
|
35
|
-
"@remotion/player": "4.0.
|
|
36
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
34
|
+
"@remotion/test-utils": "4.0.500",
|
|
35
|
+
"@remotion/player": "4.0.500",
|
|
36
|
+
"@remotion/eslint-config-internal": "4.0.500",
|
|
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