remotion 4.0.474 → 4.0.476
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/cjs/HtmlInCanvas.js +1 -3
- package/dist/cjs/Img.d.ts +6 -0
- package/dist/cjs/Img.js +2 -2
- package/dist/cjs/Interactive.d.ts +56 -0
- package/dist/cjs/Interactive.js +119 -0
- package/dist/cjs/Sequence.js +6 -3
- package/dist/cjs/SequenceContext.d.ts +1 -0
- package/dist/cjs/animated-image/AnimatedImage.js +1 -1
- package/dist/cjs/audio/AudioForPreview.js +1 -1
- package/dist/cjs/canvas-image/CanvasImage.d.ts +6 -0
- package/dist/cjs/easing.d.ts +3 -0
- package/dist/cjs/easing.js +18 -0
- package/dist/cjs/effects/Solid.js +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/internals.d.ts +21 -0
- package/dist/cjs/interpolate-colors.d.ts +2 -3
- package/dist/cjs/interpolate-colors.js +1 -0
- package/dist/cjs/interpolate-keyframed-status.js +1 -0
- package/dist/cjs/interpolate.js +147 -0
- package/dist/cjs/loop/index.js +1 -1
- package/dist/cjs/no-react.d.ts +9 -0
- package/dist/cjs/sequence-field-schema.d.ts +42 -1
- package/dist/cjs/sequence-field-schema.js +26 -5
- package/dist/cjs/series/index.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/video/VideoForPreview.js +4 -6
- package/dist/cjs/wrap-in-schema.d.ts +1 -1
- package/dist/cjs/wrap-in-schema.js +6 -4
- package/dist/esm/index.mjs +860 -583
- package/dist/esm/no-react.mjs +157 -4
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/esm/index.mjs
CHANGED
|
@@ -1291,7 +1291,7 @@ var addSequenceStackTraces = (component) => {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
|
|
1293
1293
|
// src/version.ts
|
|
1294
|
-
var VERSION = "4.0.
|
|
1294
|
+
var VERSION = "4.0.476";
|
|
1295
1295
|
|
|
1296
1296
|
// src/multiple-versions-warning.ts
|
|
1297
1297
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -1719,6 +1719,12 @@ var PremountContext = createContext14({
|
|
|
1719
1719
|
|
|
1720
1720
|
// src/sequence-field-schema.ts
|
|
1721
1721
|
var sequenceVisualStyleSchema = {
|
|
1722
|
+
"style.transformOrigin": {
|
|
1723
|
+
type: "transform-origin",
|
|
1724
|
+
step: 1,
|
|
1725
|
+
default: "50% 50%",
|
|
1726
|
+
description: "Transform origin"
|
|
1727
|
+
},
|
|
1722
1728
|
"style.translate": {
|
|
1723
1729
|
type: "translate",
|
|
1724
1730
|
step: 1,
|
|
@@ -1780,6 +1786,18 @@ var hiddenField = {
|
|
|
1780
1786
|
default: false,
|
|
1781
1787
|
description: "Hidden"
|
|
1782
1788
|
};
|
|
1789
|
+
var showInTimelineField = {
|
|
1790
|
+
type: "hidden"
|
|
1791
|
+
};
|
|
1792
|
+
var sequenceNameField = {
|
|
1793
|
+
type: "hidden"
|
|
1794
|
+
};
|
|
1795
|
+
var extendSchemaWithSequenceName = (schema) => {
|
|
1796
|
+
return {
|
|
1797
|
+
name: sequenceNameField,
|
|
1798
|
+
...schema
|
|
1799
|
+
};
|
|
1800
|
+
};
|
|
1783
1801
|
var durationInFramesField = {
|
|
1784
1802
|
type: "number",
|
|
1785
1803
|
default: undefined,
|
|
@@ -1793,8 +1811,9 @@ var fromField = {
|
|
|
1793
1811
|
step: 1,
|
|
1794
1812
|
hiddenFromList: true
|
|
1795
1813
|
};
|
|
1796
|
-
var sequenceSchema = {
|
|
1814
|
+
var sequenceSchema = extendSchemaWithSequenceName({
|
|
1797
1815
|
hidden: hiddenField,
|
|
1816
|
+
showInTimeline: showInTimelineField,
|
|
1798
1817
|
from: fromField,
|
|
1799
1818
|
durationInFrames: durationInFramesField,
|
|
1800
1819
|
layout: {
|
|
@@ -1806,12 +1825,13 @@ var sequenceSchema = {
|
|
|
1806
1825
|
none: {}
|
|
1807
1826
|
}
|
|
1808
1827
|
}
|
|
1809
|
-
};
|
|
1810
|
-
var sequenceSchemaWithoutFrom = {
|
|
1828
|
+
});
|
|
1829
|
+
var sequenceSchemaWithoutFrom = extendSchemaWithSequenceName({
|
|
1811
1830
|
hidden: hiddenField,
|
|
1831
|
+
showInTimeline: showInTimelineField,
|
|
1812
1832
|
durationInFrames: durationInFramesField,
|
|
1813
1833
|
layout: sequenceSchema.layout
|
|
1814
|
-
};
|
|
1834
|
+
});
|
|
1815
1835
|
var sequenceSchemaDefaultLayoutNone = {
|
|
1816
1836
|
...sequenceSchema,
|
|
1817
1837
|
layout: {
|
|
@@ -2176,83 +2196,6 @@ function bezier(mX1, mY1, mX2, mY2) {
|
|
|
2176
2196
|
};
|
|
2177
2197
|
}
|
|
2178
2198
|
|
|
2179
|
-
// src/easing.ts
|
|
2180
|
-
var clampUnit = (t) => Math.min(1, Math.max(0, t));
|
|
2181
|
-
|
|
2182
|
-
class Easing {
|
|
2183
|
-
static step0(n) {
|
|
2184
|
-
return n > 0 ? 1 : 0;
|
|
2185
|
-
}
|
|
2186
|
-
static step1(n) {
|
|
2187
|
-
return n >= 1 ? 1 : 0;
|
|
2188
|
-
}
|
|
2189
|
-
static linear(t) {
|
|
2190
|
-
return t;
|
|
2191
|
-
}
|
|
2192
|
-
static ease(t) {
|
|
2193
|
-
return Easing.bezier(0.42, 0, 1, 1)(t);
|
|
2194
|
-
}
|
|
2195
|
-
static quad(t) {
|
|
2196
|
-
return t * t;
|
|
2197
|
-
}
|
|
2198
|
-
static cubic(t) {
|
|
2199
|
-
return t * t * t;
|
|
2200
|
-
}
|
|
2201
|
-
static poly(n) {
|
|
2202
|
-
return (t) => t ** n;
|
|
2203
|
-
}
|
|
2204
|
-
static sin(t) {
|
|
2205
|
-
return 1 - Math.cos(t * Math.PI / 2);
|
|
2206
|
-
}
|
|
2207
|
-
static circle(t) {
|
|
2208
|
-
const u = clampUnit(t);
|
|
2209
|
-
return 1 - Math.sqrt(1 - u * u);
|
|
2210
|
-
}
|
|
2211
|
-
static exp(t) {
|
|
2212
|
-
return 2 ** (10 * (t - 1));
|
|
2213
|
-
}
|
|
2214
|
-
static elastic(bounciness = 1) {
|
|
2215
|
-
const p = bounciness * Math.PI;
|
|
2216
|
-
return (t) => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p);
|
|
2217
|
-
}
|
|
2218
|
-
static back(s = 1.70158) {
|
|
2219
|
-
return (t) => t * t * ((s + 1) * t - s);
|
|
2220
|
-
}
|
|
2221
|
-
static bounce(t) {
|
|
2222
|
-
const u = clampUnit(t);
|
|
2223
|
-
if (u < 1 / 2.75) {
|
|
2224
|
-
return 7.5625 * u * u;
|
|
2225
|
-
}
|
|
2226
|
-
if (u < 2 / 2.75) {
|
|
2227
|
-
const t2_ = u - 1.5 / 2.75;
|
|
2228
|
-
return 7.5625 * t2_ * t2_ + 0.75;
|
|
2229
|
-
}
|
|
2230
|
-
if (u < 2.5 / 2.75) {
|
|
2231
|
-
const t2_ = u - 2.25 / 2.75;
|
|
2232
|
-
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
2233
|
-
}
|
|
2234
|
-
const t2 = u - 2.625 / 2.75;
|
|
2235
|
-
return 7.5625 * t2 * t2 + 0.984375;
|
|
2236
|
-
}
|
|
2237
|
-
static bezier(x1, y1, x2, y2) {
|
|
2238
|
-
return bezier(x1, y1, x2, y2);
|
|
2239
|
-
}
|
|
2240
|
-
static in(easing) {
|
|
2241
|
-
return easing;
|
|
2242
|
-
}
|
|
2243
|
-
static out(easing) {
|
|
2244
|
-
return (t) => 1 - easing(1 - t);
|
|
2245
|
-
}
|
|
2246
|
-
static inOut(easing) {
|
|
2247
|
-
return (t) => {
|
|
2248
|
-
if (t < 0.5) {
|
|
2249
|
-
return easing(t * 2) / 2;
|
|
2250
|
-
}
|
|
2251
|
-
return 1 - easing((1 - t) * 2) / 2;
|
|
2252
|
-
};
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
2199
|
// src/normalize-number.ts
|
|
2257
2200
|
var normalizeNumber = (value) => {
|
|
2258
2201
|
return Math.round(value * 1e6) / 1e6;
|
|
@@ -2297,6 +2240,32 @@ var lengthUnits = new Set([
|
|
|
2297
2240
|
"vw"
|
|
2298
2241
|
]);
|
|
2299
2242
|
var cssNumberRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/;
|
|
2243
|
+
var transformOriginKeywords = new Set([
|
|
2244
|
+
"left",
|
|
2245
|
+
"center",
|
|
2246
|
+
"right",
|
|
2247
|
+
"top",
|
|
2248
|
+
"bottom"
|
|
2249
|
+
]);
|
|
2250
|
+
var transformOriginKeywordOptions = (keyword) => {
|
|
2251
|
+
if (keyword === "left") {
|
|
2252
|
+
return [{ axis: "x", value: { value: 0, unit: "%" } }];
|
|
2253
|
+
}
|
|
2254
|
+
if (keyword === "right") {
|
|
2255
|
+
return [{ axis: "x", value: { value: 100, unit: "%" } }];
|
|
2256
|
+
}
|
|
2257
|
+
if (keyword === "top") {
|
|
2258
|
+
return [{ axis: "y", value: { value: 0, unit: "%" } }];
|
|
2259
|
+
}
|
|
2260
|
+
if (keyword === "bottom") {
|
|
2261
|
+
return [{ axis: "y", value: { value: 100, unit: "%" } }];
|
|
2262
|
+
}
|
|
2263
|
+
return [
|
|
2264
|
+
{ axis: "x", value: { value: 50, unit: "%" } },
|
|
2265
|
+
{ axis: "y", value: { value: 50, unit: "%" } }
|
|
2266
|
+
];
|
|
2267
|
+
};
|
|
2268
|
+
var transformOriginCenter = { value: 50, unit: "%" };
|
|
2300
2269
|
var stringifyNumber = (value) => {
|
|
2301
2270
|
return String(normalizeNumber(value));
|
|
2302
2271
|
};
|
|
@@ -2321,6 +2290,110 @@ var parseStringInterpolationComponent = (component, value) => {
|
|
|
2321
2290
|
}
|
|
2322
2291
|
throw new TypeError(`Cannot interpolate "${value}" because "${unit}" is not a supported translate or rotate unit`);
|
|
2323
2292
|
};
|
|
2293
|
+
var parseTransformOriginLengthPercentage = ({
|
|
2294
|
+
component,
|
|
2295
|
+
value,
|
|
2296
|
+
allowPercentage
|
|
2297
|
+
}) => {
|
|
2298
|
+
const match = cssNumberRegex.exec(component);
|
|
2299
|
+
if (match === null) {
|
|
2300
|
+
throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not a supported transform-origin ${allowPercentage ? "length-percentage" : "z length"}`);
|
|
2301
|
+
}
|
|
2302
|
+
const unit = match[2] ?? null;
|
|
2303
|
+
const numberValue = Number(match[1]);
|
|
2304
|
+
if (!Number.isFinite(numberValue)) {
|
|
2305
|
+
throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not finite`);
|
|
2306
|
+
}
|
|
2307
|
+
if (unit === null || !lengthUnits.has(unit) || !allowPercentage && unit === "%") {
|
|
2308
|
+
throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not a supported transform-origin ${allowPercentage ? "length-percentage" : "z length"}`);
|
|
2309
|
+
}
|
|
2310
|
+
return { value: numberValue, unit };
|
|
2311
|
+
};
|
|
2312
|
+
var parseTransformOriginToken = (component, value) => {
|
|
2313
|
+
const lower = component.toLowerCase();
|
|
2314
|
+
if (transformOriginKeywords.has(lower)) {
|
|
2315
|
+
return { type: "keyword", keyword: lower };
|
|
2316
|
+
}
|
|
2317
|
+
return {
|
|
2318
|
+
type: "length-percentage",
|
|
2319
|
+
parsed: parseTransformOriginLengthPercentage({
|
|
2320
|
+
component,
|
|
2321
|
+
value,
|
|
2322
|
+
allowPercentage: true
|
|
2323
|
+
})
|
|
2324
|
+
};
|
|
2325
|
+
};
|
|
2326
|
+
var parseTwoTransformOriginKeywords = (first, second, value) => {
|
|
2327
|
+
const candidates = [];
|
|
2328
|
+
for (const firstOption of transformOriginKeywordOptions(first)) {
|
|
2329
|
+
for (const secondOption of transformOriginKeywordOptions(second)) {
|
|
2330
|
+
if (firstOption.axis === secondOption.axis) {
|
|
2331
|
+
continue;
|
|
2332
|
+
}
|
|
2333
|
+
candidates.push(firstOption.axis === "x" ? [firstOption.value, secondOption.value] : [secondOption.value, firstOption.value]);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
if (candidates.length === 0) {
|
|
2337
|
+
throw new TypeError(`Cannot interpolate "${value}" because "${first} ${second}" is not a valid transform-origin keyword pair`);
|
|
2338
|
+
}
|
|
2339
|
+
return candidates[0];
|
|
2340
|
+
};
|
|
2341
|
+
var parseTransformOriginXY = (parts, value) => {
|
|
2342
|
+
if (parts.length === 1) {
|
|
2343
|
+
const token = parseTransformOriginToken(parts[0], value);
|
|
2344
|
+
if (token.type === "length-percentage") {
|
|
2345
|
+
return [token.parsed, transformOriginCenter];
|
|
2346
|
+
}
|
|
2347
|
+
if (token.keyword === "top" || token.keyword === "bottom") {
|
|
2348
|
+
return [
|
|
2349
|
+
transformOriginCenter,
|
|
2350
|
+
transformOriginKeywordOptions(token.keyword)[0].value
|
|
2351
|
+
];
|
|
2352
|
+
}
|
|
2353
|
+
return [
|
|
2354
|
+
transformOriginKeywordOptions(token.keyword)[0].value,
|
|
2355
|
+
transformOriginCenter
|
|
2356
|
+
];
|
|
2357
|
+
}
|
|
2358
|
+
const first = parseTransformOriginToken(parts[0], value);
|
|
2359
|
+
const second = parseTransformOriginToken(parts[1], value);
|
|
2360
|
+
if (first.type === "length-percentage" && second.type === "length-percentage") {
|
|
2361
|
+
return [first.parsed, second.parsed];
|
|
2362
|
+
}
|
|
2363
|
+
if (first.type === "keyword" && second.type === "keyword") {
|
|
2364
|
+
return parseTwoTransformOriginKeywords(first.keyword, second.keyword, value);
|
|
2365
|
+
}
|
|
2366
|
+
const keyword = first.type === "keyword" ? first : second.type === "keyword" ? second : null;
|
|
2367
|
+
const length = first.type === "length-percentage" ? first.parsed : second.type === "length-percentage" ? second.parsed : null;
|
|
2368
|
+
if (keyword === null || length === null) {
|
|
2369
|
+
throw new Error("Expected a keyword and a length-percentage value");
|
|
2370
|
+
}
|
|
2371
|
+
const keywordIsFirst = first.type === "keyword";
|
|
2372
|
+
if (keyword.keyword === "left" || keyword.keyword === "right") {
|
|
2373
|
+
if (!keywordIsFirst) {
|
|
2374
|
+
throw new TypeError(`Cannot interpolate "${value}" because horizontal transform-origin keywords must come before a length-percentage value`);
|
|
2375
|
+
}
|
|
2376
|
+
return [transformOriginKeywordOptions(keyword.keyword)[0].value, length];
|
|
2377
|
+
}
|
|
2378
|
+
if (keyword.keyword === "top" || keyword.keyword === "bottom") {
|
|
2379
|
+
return [length, transformOriginKeywordOptions(keyword.keyword)[0].value];
|
|
2380
|
+
}
|
|
2381
|
+
return keywordIsFirst ? [transformOriginCenter, length] : [length, transformOriginCenter];
|
|
2382
|
+
};
|
|
2383
|
+
var parseTransformOriginValue = (output, parts) => {
|
|
2384
|
+
const [x, y] = parseTransformOriginXY(parts.slice(0, 2), output);
|
|
2385
|
+
const z = parts[2] === undefined ? { value: 0, unit: null } : parseTransformOriginLengthPercentage({
|
|
2386
|
+
component: parts[2],
|
|
2387
|
+
value: output,
|
|
2388
|
+
allowPercentage: false
|
|
2389
|
+
});
|
|
2390
|
+
return {
|
|
2391
|
+
kind: "translate",
|
|
2392
|
+
values: [x.value, y.value, z.value],
|
|
2393
|
+
units: [x.unit, y.unit, z.unit],
|
|
2394
|
+
dimensions: parts[2] === undefined ? 2 : 3
|
|
2395
|
+
};
|
|
2396
|
+
};
|
|
2324
2397
|
var parseStringInterpolationValue = (output) => {
|
|
2325
2398
|
if (typeof output === "number") {
|
|
2326
2399
|
if (!Number.isFinite(output)) {
|
|
@@ -2337,6 +2410,9 @@ var parseStringInterpolationValue = (output) => {
|
|
|
2337
2410
|
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
2338
2411
|
throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${output}"`);
|
|
2339
2412
|
}
|
|
2413
|
+
if (parts.some((part) => transformOriginKeywords.has(part.toLowerCase()))) {
|
|
2414
|
+
return parseTransformOriginValue(output, parts);
|
|
2415
|
+
}
|
|
2340
2416
|
const parsed = parts.map((part) => parseStringInterpolationComponent(part, output));
|
|
2341
2417
|
const [{ kind }] = parsed;
|
|
2342
2418
|
for (const part of parsed) {
|
|
@@ -2626,106 +2702,468 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
2626
2702
|
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
2627
2703
|
}
|
|
2628
2704
|
|
|
2629
|
-
// src/
|
|
2630
|
-
var
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
return new RegExp(name + "\\(\\s*(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")(?:\\s*\\/\\s*(" + MODERN_VALUE + "))?\\s*\\)");
|
|
2638
|
-
}
|
|
2639
|
-
function getMatchers() {
|
|
2640
|
-
const cachedMatchers = {
|
|
2641
|
-
rgb: undefined,
|
|
2642
|
-
rgba: undefined,
|
|
2643
|
-
hsl: undefined,
|
|
2644
|
-
hsla: undefined,
|
|
2645
|
-
hex3: undefined,
|
|
2646
|
-
hex4: undefined,
|
|
2647
|
-
hex5: undefined,
|
|
2648
|
-
hex6: undefined,
|
|
2649
|
-
hex8: undefined,
|
|
2650
|
-
oklch: undefined,
|
|
2651
|
-
oklab: undefined,
|
|
2652
|
-
lab: undefined,
|
|
2653
|
-
lch: undefined,
|
|
2654
|
-
hwb: undefined
|
|
2655
|
-
};
|
|
2656
|
-
if (cachedMatchers.rgb === undefined) {
|
|
2657
|
-
cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
|
|
2658
|
-
cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
2659
|
-
cachedMatchers.hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
2660
|
-
cachedMatchers.hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
2661
|
-
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
2662
|
-
cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
2663
|
-
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
2664
|
-
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
2665
|
-
cachedMatchers.oklch = modernColorCall("oklch");
|
|
2666
|
-
cachedMatchers.oklab = modernColorCall("oklab");
|
|
2667
|
-
cachedMatchers.lab = modernColorCall("lab");
|
|
2668
|
-
cachedMatchers.lch = modernColorCall("lch");
|
|
2669
|
-
cachedMatchers.hwb = modernColorCall("hwb");
|
|
2705
|
+
// src/validate-frame.ts
|
|
2706
|
+
var validateFrame = ({
|
|
2707
|
+
allowFloats,
|
|
2708
|
+
durationInFrames,
|
|
2709
|
+
frame
|
|
2710
|
+
}) => {
|
|
2711
|
+
if (typeof frame === "undefined") {
|
|
2712
|
+
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
2670
2713
|
}
|
|
2671
|
-
|
|
2672
|
-
}
|
|
2673
|
-
function hue2rgb(p, q, t) {
|
|
2674
|
-
if (t < 0) {
|
|
2675
|
-
t += 1;
|
|
2714
|
+
if (typeof frame !== "number") {
|
|
2715
|
+
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
2676
2716
|
}
|
|
2677
|
-
if (
|
|
2678
|
-
|
|
2717
|
+
if (!Number.isFinite(frame)) {
|
|
2718
|
+
throw new RangeError(`Frame ${frame} is not finite`);
|
|
2679
2719
|
}
|
|
2680
|
-
if (
|
|
2681
|
-
|
|
2720
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
2721
|
+
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
2682
2722
|
}
|
|
2683
|
-
if (
|
|
2684
|
-
|
|
2723
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
2724
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
2685
2725
|
}
|
|
2686
|
-
if (
|
|
2687
|
-
|
|
2726
|
+
if (frame > durationInFrames - 1) {
|
|
2727
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
2688
2728
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
const g = hue2rgb(p, q, h);
|
|
2696
|
-
const b2 = hue2rgb(p, q, h - 1 / 3);
|
|
2697
|
-
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b2 * 255) << 8;
|
|
2698
|
-
}
|
|
2699
|
-
function parse255(str) {
|
|
2700
|
-
const int = Number.parseInt(str, 10);
|
|
2701
|
-
if (int < 0) {
|
|
2702
|
-
return 0;
|
|
2729
|
+
};
|
|
2730
|
+
|
|
2731
|
+
// src/validation/validation-spring-duration.ts
|
|
2732
|
+
var validateSpringDuration = (dur) => {
|
|
2733
|
+
if (typeof dur === "undefined") {
|
|
2734
|
+
return;
|
|
2703
2735
|
}
|
|
2704
|
-
if (
|
|
2705
|
-
|
|
2736
|
+
if (typeof dur !== "number") {
|
|
2737
|
+
throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof dur}"`);
|
|
2706
2738
|
}
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
function parse360(str) {
|
|
2710
|
-
const int = Number.parseFloat(str);
|
|
2711
|
-
return (int % 360 + 360) % 360 / 360;
|
|
2712
|
-
}
|
|
2713
|
-
function parse1(str) {
|
|
2714
|
-
const num = Number.parseFloat(str);
|
|
2715
|
-
if (num < 0) {
|
|
2716
|
-
return 0;
|
|
2739
|
+
if (Number.isNaN(dur)) {
|
|
2740
|
+
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
2717
2741
|
}
|
|
2718
|
-
if (
|
|
2719
|
-
|
|
2742
|
+
if (!Number.isFinite(dur)) {
|
|
2743
|
+
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
2720
2744
|
}
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
function parsePercentage(str) {
|
|
2724
|
-
const int = Number.parseFloat(str);
|
|
2725
|
-
if (int < 0) {
|
|
2726
|
-
return 0;
|
|
2745
|
+
if (dur <= 0) {
|
|
2746
|
+
throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
|
|
2727
2747
|
}
|
|
2728
|
-
|
|
2748
|
+
};
|
|
2749
|
+
|
|
2750
|
+
// src/spring/spring-utils.ts
|
|
2751
|
+
var defaultSpringConfig = {
|
|
2752
|
+
damping: 10,
|
|
2753
|
+
mass: 1,
|
|
2754
|
+
stiffness: 100,
|
|
2755
|
+
overshootClamping: false
|
|
2756
|
+
};
|
|
2757
|
+
var advanceCache = {};
|
|
2758
|
+
function advance({
|
|
2759
|
+
animation,
|
|
2760
|
+
now,
|
|
2761
|
+
config
|
|
2762
|
+
}) {
|
|
2763
|
+
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
2764
|
+
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
2765
|
+
if (config.damping <= 0) {
|
|
2766
|
+
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
2767
|
+
}
|
|
2768
|
+
const c2 = config.damping;
|
|
2769
|
+
const m = config.mass;
|
|
2770
|
+
const k = config.stiffness;
|
|
2771
|
+
const cacheKey = [
|
|
2772
|
+
toValue,
|
|
2773
|
+
lastTimestamp,
|
|
2774
|
+
current,
|
|
2775
|
+
velocity,
|
|
2776
|
+
c2,
|
|
2777
|
+
m,
|
|
2778
|
+
k,
|
|
2779
|
+
now
|
|
2780
|
+
].join("-");
|
|
2781
|
+
if (advanceCache[cacheKey]) {
|
|
2782
|
+
return advanceCache[cacheKey];
|
|
2783
|
+
}
|
|
2784
|
+
const v0 = -velocity;
|
|
2785
|
+
const x0 = toValue - current;
|
|
2786
|
+
const zeta = c2 / (2 * Math.sqrt(k * m));
|
|
2787
|
+
const omega0 = Math.sqrt(k / m);
|
|
2788
|
+
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
2789
|
+
const t = deltaTime / 1000;
|
|
2790
|
+
const sin1 = Math.sin(omega1 * t);
|
|
2791
|
+
const cos1 = Math.cos(omega1 * t);
|
|
2792
|
+
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
2793
|
+
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
2794
|
+
const underDampedPosition = toValue - underDampedFrag1;
|
|
2795
|
+
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
2796
|
+
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
2797
|
+
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
2798
|
+
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
2799
|
+
const animationNode = {
|
|
2800
|
+
toValue,
|
|
2801
|
+
prevPosition: current,
|
|
2802
|
+
lastTimestamp: now,
|
|
2803
|
+
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
2804
|
+
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
2805
|
+
};
|
|
2806
|
+
advanceCache[cacheKey] = animationNode;
|
|
2807
|
+
return animationNode;
|
|
2808
|
+
}
|
|
2809
|
+
var calculationCache = {};
|
|
2810
|
+
function springCalculation({
|
|
2811
|
+
frame,
|
|
2812
|
+
fps,
|
|
2813
|
+
config = {}
|
|
2814
|
+
}) {
|
|
2815
|
+
const from = 0;
|
|
2816
|
+
const to = 1;
|
|
2817
|
+
const cacheKey = [
|
|
2818
|
+
frame,
|
|
2819
|
+
fps,
|
|
2820
|
+
config.damping,
|
|
2821
|
+
config.mass,
|
|
2822
|
+
config.overshootClamping,
|
|
2823
|
+
config.stiffness
|
|
2824
|
+
].join("-");
|
|
2825
|
+
if (calculationCache[cacheKey]) {
|
|
2826
|
+
return calculationCache[cacheKey];
|
|
2827
|
+
}
|
|
2828
|
+
let animation = {
|
|
2829
|
+
lastTimestamp: 0,
|
|
2830
|
+
current: from,
|
|
2831
|
+
toValue: to,
|
|
2832
|
+
velocity: 0,
|
|
2833
|
+
prevPosition: 0
|
|
2834
|
+
};
|
|
2835
|
+
const frameClamped = Math.max(0, frame);
|
|
2836
|
+
const unevenRest = frameClamped % 1;
|
|
2837
|
+
for (let f = 0;f <= Math.floor(frameClamped); f++) {
|
|
2838
|
+
if (f === Math.floor(frameClamped)) {
|
|
2839
|
+
f += unevenRest;
|
|
2840
|
+
}
|
|
2841
|
+
const time = f / fps * 1000;
|
|
2842
|
+
animation = advance({
|
|
2843
|
+
animation,
|
|
2844
|
+
now: time,
|
|
2845
|
+
config: {
|
|
2846
|
+
...defaultSpringConfig,
|
|
2847
|
+
...config
|
|
2848
|
+
}
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
calculationCache[cacheKey] = animation;
|
|
2852
|
+
return animation;
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
// src/spring/measure-spring.ts
|
|
2856
|
+
var cache = new Map;
|
|
2857
|
+
function measureSpring({
|
|
2858
|
+
fps,
|
|
2859
|
+
config = {},
|
|
2860
|
+
threshold = 0.005
|
|
2861
|
+
}) {
|
|
2862
|
+
if (typeof threshold !== "number") {
|
|
2863
|
+
throw new TypeError(`threshold must be a number, got ${threshold} of type ${typeof threshold}`);
|
|
2864
|
+
}
|
|
2865
|
+
if (threshold === 0) {
|
|
2866
|
+
return Infinity;
|
|
2867
|
+
}
|
|
2868
|
+
if (threshold === 1) {
|
|
2869
|
+
return 0;
|
|
2870
|
+
}
|
|
2871
|
+
if (isNaN(threshold)) {
|
|
2872
|
+
throw new TypeError("Threshold is NaN");
|
|
2873
|
+
}
|
|
2874
|
+
if (!Number.isFinite(threshold)) {
|
|
2875
|
+
throw new TypeError("Threshold is not finite");
|
|
2876
|
+
}
|
|
2877
|
+
if (threshold < 0) {
|
|
2878
|
+
throw new TypeError("Threshold is below 0");
|
|
2879
|
+
}
|
|
2880
|
+
const cacheKey = [
|
|
2881
|
+
fps,
|
|
2882
|
+
config.damping,
|
|
2883
|
+
config.mass,
|
|
2884
|
+
config.overshootClamping,
|
|
2885
|
+
config.stiffness,
|
|
2886
|
+
threshold
|
|
2887
|
+
].join("-");
|
|
2888
|
+
if (cache.has(cacheKey)) {
|
|
2889
|
+
return cache.get(cacheKey);
|
|
2890
|
+
}
|
|
2891
|
+
validateFps(fps, "to the measureSpring() function", false);
|
|
2892
|
+
let frame = 0;
|
|
2893
|
+
let finishedFrame = 0;
|
|
2894
|
+
const calc = () => {
|
|
2895
|
+
return springCalculation({
|
|
2896
|
+
fps,
|
|
2897
|
+
frame,
|
|
2898
|
+
config
|
|
2899
|
+
});
|
|
2900
|
+
};
|
|
2901
|
+
let animation = calc();
|
|
2902
|
+
const calcDifference = () => {
|
|
2903
|
+
return Math.abs(animation.current - animation.toValue);
|
|
2904
|
+
};
|
|
2905
|
+
let difference = calcDifference();
|
|
2906
|
+
while (difference >= threshold) {
|
|
2907
|
+
frame++;
|
|
2908
|
+
animation = calc();
|
|
2909
|
+
difference = calcDifference();
|
|
2910
|
+
}
|
|
2911
|
+
finishedFrame = frame;
|
|
2912
|
+
for (let i = 0;i < 20; i++) {
|
|
2913
|
+
frame++;
|
|
2914
|
+
animation = calc();
|
|
2915
|
+
difference = calcDifference();
|
|
2916
|
+
if (difference >= threshold) {
|
|
2917
|
+
i = 0;
|
|
2918
|
+
finishedFrame = frame + 1;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
cache.set(cacheKey, finishedFrame);
|
|
2922
|
+
return finishedFrame;
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
// src/spring/index.ts
|
|
2926
|
+
function spring({
|
|
2927
|
+
frame: passedFrame,
|
|
2928
|
+
fps,
|
|
2929
|
+
config = {},
|
|
2930
|
+
from = 0,
|
|
2931
|
+
to = 1,
|
|
2932
|
+
durationInFrames: passedDurationInFrames,
|
|
2933
|
+
durationRestThreshold,
|
|
2934
|
+
delay = 0,
|
|
2935
|
+
reverse = false
|
|
2936
|
+
}) {
|
|
2937
|
+
validateSpringDuration(passedDurationInFrames);
|
|
2938
|
+
validateFrame({
|
|
2939
|
+
frame: passedFrame,
|
|
2940
|
+
durationInFrames: Infinity,
|
|
2941
|
+
allowFloats: true
|
|
2942
|
+
});
|
|
2943
|
+
validateFps(fps, "to spring()", false);
|
|
2944
|
+
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
2945
|
+
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring({
|
|
2946
|
+
fps,
|
|
2947
|
+
config,
|
|
2948
|
+
threshold: durationRestThreshold
|
|
2949
|
+
}) : undefined;
|
|
2950
|
+
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
2951
|
+
get: () => naturalDuration
|
|
2952
|
+
} : {
|
|
2953
|
+
get: () => {
|
|
2954
|
+
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
2958
|
+
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
2959
|
+
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
2960
|
+
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
2961
|
+
return to;
|
|
2962
|
+
}
|
|
2963
|
+
const spr = springCalculation({
|
|
2964
|
+
fps,
|
|
2965
|
+
frame: durationProcessed,
|
|
2966
|
+
config
|
|
2967
|
+
});
|
|
2968
|
+
const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
|
|
2969
|
+
const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
|
|
2970
|
+
return interpolated;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
// src/easing.ts
|
|
2974
|
+
var clampUnit = (t) => Math.min(1, Math.max(0, t));
|
|
2975
|
+
var springEasingDurationInFrames = 30;
|
|
2976
|
+
|
|
2977
|
+
class Easing {
|
|
2978
|
+
static step0(n) {
|
|
2979
|
+
return n > 0 ? 1 : 0;
|
|
2980
|
+
}
|
|
2981
|
+
static step1(n) {
|
|
2982
|
+
return n >= 1 ? 1 : 0;
|
|
2983
|
+
}
|
|
2984
|
+
static linear(t) {
|
|
2985
|
+
return t;
|
|
2986
|
+
}
|
|
2987
|
+
static ease(t) {
|
|
2988
|
+
return Easing.bezier(0.42, 0, 1, 1)(t);
|
|
2989
|
+
}
|
|
2990
|
+
static quad(t) {
|
|
2991
|
+
return t * t;
|
|
2992
|
+
}
|
|
2993
|
+
static cubic(t) {
|
|
2994
|
+
return t * t * t;
|
|
2995
|
+
}
|
|
2996
|
+
static poly(n) {
|
|
2997
|
+
return (t) => t ** n;
|
|
2998
|
+
}
|
|
2999
|
+
static sin(t) {
|
|
3000
|
+
return 1 - Math.cos(t * Math.PI / 2);
|
|
3001
|
+
}
|
|
3002
|
+
static circle(t) {
|
|
3003
|
+
const u = clampUnit(t);
|
|
3004
|
+
return 1 - Math.sqrt(1 - u * u);
|
|
3005
|
+
}
|
|
3006
|
+
static exp(t) {
|
|
3007
|
+
return 2 ** (10 * (t - 1));
|
|
3008
|
+
}
|
|
3009
|
+
static elastic(bounciness = 1) {
|
|
3010
|
+
const p = bounciness * Math.PI;
|
|
3011
|
+
return (t) => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p);
|
|
3012
|
+
}
|
|
3013
|
+
static back(s = 1.70158) {
|
|
3014
|
+
return (t) => t * t * ((s + 1) * t - s);
|
|
3015
|
+
}
|
|
3016
|
+
static spring(config = {}) {
|
|
3017
|
+
return (t) => {
|
|
3018
|
+
if (t <= 0) {
|
|
3019
|
+
return 0;
|
|
3020
|
+
}
|
|
3021
|
+
if (t >= 1) {
|
|
3022
|
+
return 1;
|
|
3023
|
+
}
|
|
3024
|
+
return spring({
|
|
3025
|
+
fps: springEasingDurationInFrames,
|
|
3026
|
+
frame: t * springEasingDurationInFrames,
|
|
3027
|
+
config,
|
|
3028
|
+
durationInFrames: springEasingDurationInFrames
|
|
3029
|
+
});
|
|
3030
|
+
};
|
|
3031
|
+
}
|
|
3032
|
+
static bounce(t) {
|
|
3033
|
+
const u = clampUnit(t);
|
|
3034
|
+
if (u < 1 / 2.75) {
|
|
3035
|
+
return 7.5625 * u * u;
|
|
3036
|
+
}
|
|
3037
|
+
if (u < 2 / 2.75) {
|
|
3038
|
+
const t2_ = u - 1.5 / 2.75;
|
|
3039
|
+
return 7.5625 * t2_ * t2_ + 0.75;
|
|
3040
|
+
}
|
|
3041
|
+
if (u < 2.5 / 2.75) {
|
|
3042
|
+
const t2_ = u - 2.25 / 2.75;
|
|
3043
|
+
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
3044
|
+
}
|
|
3045
|
+
const t2 = u - 2.625 / 2.75;
|
|
3046
|
+
return 7.5625 * t2 * t2 + 0.984375;
|
|
3047
|
+
}
|
|
3048
|
+
static bezier(x1, y1, x2, y2) {
|
|
3049
|
+
return bezier(x1, y1, x2, y2);
|
|
3050
|
+
}
|
|
3051
|
+
static in(easing) {
|
|
3052
|
+
return easing;
|
|
3053
|
+
}
|
|
3054
|
+
static out(easing) {
|
|
3055
|
+
return (t) => 1 - easing(1 - t);
|
|
3056
|
+
}
|
|
3057
|
+
static inOut(easing) {
|
|
3058
|
+
return (t) => {
|
|
3059
|
+
if (t < 0.5) {
|
|
3060
|
+
return easing(t * 2) / 2;
|
|
3061
|
+
}
|
|
3062
|
+
return 1 - easing((1 - t) * 2) / 2;
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
// src/interpolate-colors.ts
|
|
3068
|
+
var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
3069
|
+
var PERCENTAGE = NUMBER + "%";
|
|
3070
|
+
function call(...args) {
|
|
3071
|
+
return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
|
|
3072
|
+
}
|
|
3073
|
+
var MODERN_VALUE = "(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";
|
|
3074
|
+
function modernColorCall(name) {
|
|
3075
|
+
return new RegExp(name + "\\(\\s*(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")\\s+(" + MODERN_VALUE + ")(?:\\s*\\/\\s*(" + MODERN_VALUE + "))?\\s*\\)");
|
|
3076
|
+
}
|
|
3077
|
+
function getMatchers() {
|
|
3078
|
+
const cachedMatchers = {
|
|
3079
|
+
rgb: undefined,
|
|
3080
|
+
rgba: undefined,
|
|
3081
|
+
hsl: undefined,
|
|
3082
|
+
hsla: undefined,
|
|
3083
|
+
hex3: undefined,
|
|
3084
|
+
hex4: undefined,
|
|
3085
|
+
hex5: undefined,
|
|
3086
|
+
hex6: undefined,
|
|
3087
|
+
hex8: undefined,
|
|
3088
|
+
oklch: undefined,
|
|
3089
|
+
oklab: undefined,
|
|
3090
|
+
lab: undefined,
|
|
3091
|
+
lch: undefined,
|
|
3092
|
+
hwb: undefined
|
|
3093
|
+
};
|
|
3094
|
+
if (cachedMatchers.rgb === undefined) {
|
|
3095
|
+
cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
|
|
3096
|
+
cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
3097
|
+
cachedMatchers.hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
3098
|
+
cachedMatchers.hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
3099
|
+
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3100
|
+
cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
3101
|
+
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
3102
|
+
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
3103
|
+
cachedMatchers.oklch = modernColorCall("oklch");
|
|
3104
|
+
cachedMatchers.oklab = modernColorCall("oklab");
|
|
3105
|
+
cachedMatchers.lab = modernColorCall("lab");
|
|
3106
|
+
cachedMatchers.lch = modernColorCall("lch");
|
|
3107
|
+
cachedMatchers.hwb = modernColorCall("hwb");
|
|
3108
|
+
}
|
|
3109
|
+
return cachedMatchers;
|
|
3110
|
+
}
|
|
3111
|
+
function hue2rgb(p, q, t) {
|
|
3112
|
+
if (t < 0) {
|
|
3113
|
+
t += 1;
|
|
3114
|
+
}
|
|
3115
|
+
if (t > 1) {
|
|
3116
|
+
t -= 1;
|
|
3117
|
+
}
|
|
3118
|
+
if (t < 1 / 6) {
|
|
3119
|
+
return p + (q - p) * 6 * t;
|
|
3120
|
+
}
|
|
3121
|
+
if (t < 1 / 2) {
|
|
3122
|
+
return q;
|
|
3123
|
+
}
|
|
3124
|
+
if (t < 2 / 3) {
|
|
3125
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
3126
|
+
}
|
|
3127
|
+
return p;
|
|
3128
|
+
}
|
|
3129
|
+
function hslToRgb(h, s, l) {
|
|
3130
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
3131
|
+
const p = 2 * l - q;
|
|
3132
|
+
const r = hue2rgb(p, q, h + 1 / 3);
|
|
3133
|
+
const g = hue2rgb(p, q, h);
|
|
3134
|
+
const b2 = hue2rgb(p, q, h - 1 / 3);
|
|
3135
|
+
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b2 * 255) << 8;
|
|
3136
|
+
}
|
|
3137
|
+
function parse255(str) {
|
|
3138
|
+
const int = Number.parseInt(str, 10);
|
|
3139
|
+
if (int < 0) {
|
|
3140
|
+
return 0;
|
|
3141
|
+
}
|
|
3142
|
+
if (int > 255) {
|
|
3143
|
+
return 255;
|
|
3144
|
+
}
|
|
3145
|
+
return int;
|
|
3146
|
+
}
|
|
3147
|
+
function parse360(str) {
|
|
3148
|
+
const int = Number.parseFloat(str);
|
|
3149
|
+
return (int % 360 + 360) % 360 / 360;
|
|
3150
|
+
}
|
|
3151
|
+
function parse1(str) {
|
|
3152
|
+
const num = Number.parseFloat(str);
|
|
3153
|
+
if (num < 0) {
|
|
3154
|
+
return 0;
|
|
3155
|
+
}
|
|
3156
|
+
if (num > 1) {
|
|
3157
|
+
return 255;
|
|
3158
|
+
}
|
|
3159
|
+
return Math.round(num * 255);
|
|
3160
|
+
}
|
|
3161
|
+
function parsePercentage(str) {
|
|
3162
|
+
const int = Number.parseFloat(str);
|
|
3163
|
+
if (int < 0) {
|
|
3164
|
+
return 0;
|
|
3165
|
+
}
|
|
3166
|
+
if (int > 100) {
|
|
2729
3167
|
return 1;
|
|
2730
3168
|
}
|
|
2731
3169
|
return int / 100;
|
|
@@ -3094,6 +3532,7 @@ function processColor(color) {
|
|
|
3094
3532
|
var interpolateColorsRGB = (value, inputRange, colors, options) => {
|
|
3095
3533
|
const [r, g, b2, a2] = [red, green, blue, opacity].map((f) => {
|
|
3096
3534
|
const unrounded = interpolate(value, inputRange, colors.map((c2) => f(c2)), {
|
|
3535
|
+
easing: options?.easing,
|
|
3097
3536
|
extrapolateLeft: "clamp",
|
|
3098
3537
|
extrapolateRight: "clamp",
|
|
3099
3538
|
posterize: options?.posterize
|
|
@@ -3149,6 +3588,7 @@ var interpolateKeyframedStatus = ({
|
|
|
3149
3588
|
}
|
|
3150
3589
|
try {
|
|
3151
3590
|
return interpolateColors(frame, inputRange, outputs, {
|
|
3591
|
+
easing: easing.map(easingToFn),
|
|
3152
3592
|
posterize: status.posterize
|
|
3153
3593
|
});
|
|
3154
3594
|
} catch {
|
|
@@ -3638,7 +4078,8 @@ var wrapInSchema = ({
|
|
|
3638
4078
|
schema,
|
|
3639
4079
|
supportsEffects
|
|
3640
4080
|
}) => {
|
|
3641
|
-
const
|
|
4081
|
+
const schemaWithSequenceName = extendSchemaWithSequenceName(schema);
|
|
4082
|
+
const flatSchema = getFlatSchemaWithAllKeys(schemaWithSequenceName);
|
|
3642
4083
|
const flatKeys = Object.keys(flatSchema);
|
|
3643
4084
|
const Wrapped = forwardRef2((props, ref) => {
|
|
3644
4085
|
const env = useRemotionEnvironment();
|
|
@@ -3677,7 +4118,7 @@ var wrapInSchema = ({
|
|
|
3677
4118
|
const currentRuntimeValueDotNotation = useMemo13(() => readValuesFromProps(props, flatKeys), runtimeValues);
|
|
3678
4119
|
const controls = useMemo13(() => {
|
|
3679
4120
|
return {
|
|
3680
|
-
schema,
|
|
4121
|
+
schema: schemaWithSequenceName,
|
|
3681
4122
|
currentRuntimeValueDotNotation,
|
|
3682
4123
|
overrideId,
|
|
3683
4124
|
supportsEffects
|
|
@@ -3685,7 +4126,7 @@ var wrapInSchema = ({
|
|
|
3685
4126
|
}, [currentRuntimeValueDotNotation, overrideId]);
|
|
3686
4127
|
const { merged: valuesDotNotation, propsToDelete } = useMemo13(() => {
|
|
3687
4128
|
return computeEffectiveSchemaValuesDotNotation({
|
|
3688
|
-
schema,
|
|
4129
|
+
schema: schemaWithSequenceName,
|
|
3689
4130
|
currentValue: currentRuntimeValueDotNotation,
|
|
3690
4131
|
overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
|
|
3691
4132
|
propStatus: nodePath === null ? undefined : getPropStatusesCtx(propStatuses, nodePath),
|
|
@@ -3698,7 +4139,7 @@ var wrapInSchema = ({
|
|
|
3698
4139
|
propStatuses,
|
|
3699
4140
|
frame
|
|
3700
4141
|
]);
|
|
3701
|
-
const activeKeys = selectActiveKeys(
|
|
4142
|
+
const activeKeys = selectActiveKeys(schemaWithSequenceName, valuesDotNotation);
|
|
3702
4143
|
const mergedProps = mergeValues({
|
|
3703
4144
|
props,
|
|
3704
4145
|
valuesDotNotation,
|
|
@@ -3743,6 +4184,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
3743
4184
|
const parentSequence = useContext17(SequenceContext);
|
|
3744
4185
|
const { rootId } = useTimelineContext();
|
|
3745
4186
|
const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
|
|
4187
|
+
const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + from;
|
|
3746
4188
|
const nonce = useNonce();
|
|
3747
4189
|
if (layout !== "absolute-fill" && layout !== "none") {
|
|
3748
4190
|
throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
|
|
@@ -3780,6 +4222,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
3780
4222
|
const cumulatedNegativeFrom = currentSequenceStart - firstFrame;
|
|
3781
4223
|
const contextValue = useMemo14(() => {
|
|
3782
4224
|
return {
|
|
4225
|
+
absoluteFrom,
|
|
3783
4226
|
cumulatedFrom,
|
|
3784
4227
|
relativeFrom: from,
|
|
3785
4228
|
cumulatedNegativeFrom,
|
|
@@ -3795,6 +4238,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
3795
4238
|
};
|
|
3796
4239
|
}, [
|
|
3797
4240
|
cumulatedFrom,
|
|
4241
|
+
absoluteFrom,
|
|
3798
4242
|
from,
|
|
3799
4243
|
actualDurationInFrames,
|
|
3800
4244
|
parentSequence,
|
|
@@ -3810,7 +4254,7 @@ var RegularSequenceRefForwardingFunction = ({
|
|
|
3810
4254
|
const timelineClipName = useMemo14(() => {
|
|
3811
4255
|
return name ?? "";
|
|
3812
4256
|
}, [name]);
|
|
3813
|
-
const resolvedDocumentationLink = documentationLink ??
|
|
4257
|
+
const resolvedDocumentationLink = documentationLink ?? "https://www.remotion.dev/docs/sequence";
|
|
3814
4258
|
const env = useRemotionEnvironment();
|
|
3815
4259
|
const isInsideSeries = useContext17(IsInsideSeriesContext);
|
|
3816
4260
|
const inheritedStack = other?.stack ?? null;
|
|
@@ -4468,10 +4912,10 @@ var decodeImage = async ({
|
|
|
4468
4912
|
if (!selectedTrack) {
|
|
4469
4913
|
throw new Error("No selected track");
|
|
4470
4914
|
}
|
|
4471
|
-
const
|
|
4915
|
+
const cache2 = [];
|
|
4472
4916
|
let durationFound = null;
|
|
4473
4917
|
const getFrameByIndex = async (frameIndex) => {
|
|
4474
|
-
const foundInCache =
|
|
4918
|
+
const foundInCache = cache2.find((c2) => c2.frameIndex === frameIndex);
|
|
4475
4919
|
if (foundInCache && foundInCache.frame) {
|
|
4476
4920
|
return foundInCache;
|
|
4477
4921
|
}
|
|
@@ -4482,7 +4926,7 @@ var decodeImage = async ({
|
|
|
4482
4926
|
if (foundInCache) {
|
|
4483
4927
|
foundInCache.frame = frame.image;
|
|
4484
4928
|
} else {
|
|
4485
|
-
|
|
4929
|
+
cache2.push({
|
|
4486
4930
|
frame: frame.image,
|
|
4487
4931
|
frameIndex,
|
|
4488
4932
|
timeInSeconds: frame.image.timestamp / 1e6
|
|
@@ -4495,7 +4939,7 @@ var decodeImage = async ({
|
|
|
4495
4939
|
};
|
|
4496
4940
|
};
|
|
4497
4941
|
const clearCache = (closeToTimeInSec) => {
|
|
4498
|
-
const itemsInCache =
|
|
4942
|
+
const itemsInCache = cache2.filter((c2) => c2.frame);
|
|
4499
4943
|
const sortByClosestToCurrentTime = itemsInCache.sort((a2, b2) => {
|
|
4500
4944
|
const aDiff = Math.abs(a2.timeInSeconds - closeToTimeInSec);
|
|
4501
4945
|
const bDiff = Math.abs(b2.timeInSeconds - closeToTimeInSec);
|
|
@@ -4518,7 +4962,7 @@ var decodeImage = async ({
|
|
|
4518
4962
|
loopBehavior,
|
|
4519
4963
|
timeInSec
|
|
4520
4964
|
});
|
|
4521
|
-
const framesBefore =
|
|
4965
|
+
const framesBefore = cache2.filter((c2) => c2.timeInSeconds <= actualTimeInSec);
|
|
4522
4966
|
const biggestIndex = framesBefore.map((c2) => c2.frameIndex).reduce((a2, b2) => Math.max(a2, b2), 0);
|
|
4523
4967
|
let i = biggestIndex;
|
|
4524
4968
|
while (true) {
|
|
@@ -4561,7 +5005,7 @@ var decodeImage = async ({
|
|
|
4561
5005
|
timeInSec
|
|
4562
5006
|
});
|
|
4563
5007
|
await ensureFrameBeforeAndAfter({ timeInSec: actualTimeInSec, loopBehavior });
|
|
4564
|
-
const itemsInCache =
|
|
5008
|
+
const itemsInCache = cache2.filter((c2) => c2.frame);
|
|
4565
5009
|
const closest = itemsInCache.reduce((a2, b2) => {
|
|
4566
5010
|
const aDiff = Math.abs(a2.timeInSeconds - actualTimeInSec);
|
|
4567
5011
|
const bDiff = Math.abs(b2.timeInSeconds - actualTimeInSec);
|
|
@@ -4611,7 +5055,7 @@ var animatedImageSchema = {
|
|
|
4611
5055
|
max: 10,
|
|
4612
5056
|
step: 0.1,
|
|
4613
5057
|
default: 1,
|
|
4614
|
-
description: "Playback
|
|
5058
|
+
description: "Playback rate",
|
|
4615
5059
|
hiddenFromList: false,
|
|
4616
5060
|
keyframable: false
|
|
4617
5061
|
},
|
|
@@ -5059,7 +5503,7 @@ var Loop = ({
|
|
|
5059
5503
|
durationInFrames,
|
|
5060
5504
|
from,
|
|
5061
5505
|
name: name ?? "<Loop>",
|
|
5062
|
-
_remotionInternalDocumentationLink:
|
|
5506
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/loop",
|
|
5063
5507
|
_remotionInternalLoopDisplay: loopDisplay,
|
|
5064
5508
|
layout: props.layout,
|
|
5065
5509
|
style,
|
|
@@ -7588,7 +8032,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
|
|
|
7588
8032
|
premountDisplay: sequenceContext?.premountDisplay ?? null,
|
|
7589
8033
|
postmountDisplay: sequenceContext?.postmountDisplay ?? null,
|
|
7590
8034
|
loopDisplay: undefined,
|
|
7591
|
-
documentationLink:
|
|
8035
|
+
documentationLink: "https://www.remotion.dev/docs/html5-audio",
|
|
7592
8036
|
refForOutline: null
|
|
7593
8037
|
});
|
|
7594
8038
|
useMediaPlayback({
|
|
@@ -8108,7 +8552,7 @@ var SolidOuter = forwardRef8(({
|
|
|
8108
8552
|
durationInFrames,
|
|
8109
8553
|
name: name ?? "<Solid>",
|
|
8110
8554
|
_remotionInternalRefForOutline: actualRef,
|
|
8111
|
-
_remotionInternalDocumentationLink:
|
|
8555
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/solid",
|
|
8112
8556
|
...props2,
|
|
8113
8557
|
children: /* @__PURE__ */ jsx24(SolidInner, {
|
|
8114
8558
|
reference: actualRef,
|
|
@@ -8431,7 +8875,7 @@ var HtmlInCanvasInner = forwardRef9(({
|
|
|
8431
8875
|
return /* @__PURE__ */ jsx25(Sequence, {
|
|
8432
8876
|
durationInFrames: resolvedDuration,
|
|
8433
8877
|
name: name ?? "<HtmlInCanvas>",
|
|
8434
|
-
_remotionInternalDocumentationLink:
|
|
8878
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/remotion/html-in-canvas",
|
|
8435
8879
|
_experimentalControls: controls,
|
|
8436
8880
|
_remotionInternalEffects: memoizedEffectDefinitions,
|
|
8437
8881
|
_remotionInternalRefForOutline: actualRef,
|
|
@@ -9048,7 +9492,7 @@ var NativeImgInner = ({
|
|
|
9048
9492
|
from: from ?? 0,
|
|
9049
9493
|
durationInFrames: durationInFrames ?? Infinity,
|
|
9050
9494
|
_remotionInternalStack: stack,
|
|
9051
|
-
_remotionInternalDocumentationLink:
|
|
9495
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
|
|
9052
9496
|
_remotionInternalIsMedia: { type: "image", src },
|
|
9053
9497
|
name: name ?? "<Img>",
|
|
9054
9498
|
_experimentalControls: controls,
|
|
@@ -9190,7 +9634,7 @@ var ImgInner = ({
|
|
|
9190
9634
|
name: name ?? "<Img>",
|
|
9191
9635
|
showInTimeline,
|
|
9192
9636
|
stack,
|
|
9193
|
-
_remotionInternalDocumentationLink:
|
|
9637
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
|
|
9194
9638
|
_experimentalControls: controls,
|
|
9195
9639
|
_remotionInternalRefForOutline: refForOutline,
|
|
9196
9640
|
...canvasProps
|
|
@@ -9202,22 +9646,119 @@ var Img = wrapInSchema({
|
|
|
9202
9646
|
supportsEffects: true
|
|
9203
9647
|
});
|
|
9204
9648
|
addSequenceStackTraces(Img);
|
|
9649
|
+
// src/Interactive.tsx
|
|
9650
|
+
import React29, { forwardRef as forwardRef12, useCallback as useCallback19, useRef as useRef25 } from "react";
|
|
9651
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
9652
|
+
var interactiveElementSchema = {
|
|
9653
|
+
durationInFrames: durationInFramesField,
|
|
9654
|
+
from: fromField,
|
|
9655
|
+
...sequenceVisualStyleSchema,
|
|
9656
|
+
hidden: hiddenField
|
|
9657
|
+
};
|
|
9658
|
+
var setRef = (ref, value) => {
|
|
9659
|
+
if (typeof ref === "function") {
|
|
9660
|
+
ref(value);
|
|
9661
|
+
} else if (ref) {
|
|
9662
|
+
ref.current = value;
|
|
9663
|
+
}
|
|
9664
|
+
};
|
|
9665
|
+
var makeInteractiveElement = (tag, displayName) => {
|
|
9666
|
+
const Inner = forwardRef12((propsWithControls, ref) => {
|
|
9667
|
+
const {
|
|
9668
|
+
durationInFrames,
|
|
9669
|
+
from,
|
|
9670
|
+
hidden,
|
|
9671
|
+
name,
|
|
9672
|
+
showInTimeline,
|
|
9673
|
+
stack,
|
|
9674
|
+
_experimentalControls,
|
|
9675
|
+
...props2
|
|
9676
|
+
} = propsWithControls;
|
|
9677
|
+
const refForOutline = useRef25(null);
|
|
9678
|
+
const callbackRef = useCallback19((element) => {
|
|
9679
|
+
refForOutline.current = element;
|
|
9680
|
+
setRef(ref, element);
|
|
9681
|
+
}, [ref]);
|
|
9682
|
+
return /* @__PURE__ */ jsx29(Sequence, {
|
|
9683
|
+
layout: "none",
|
|
9684
|
+
from: from ?? 0,
|
|
9685
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
9686
|
+
hidden,
|
|
9687
|
+
name: name ?? displayName,
|
|
9688
|
+
showInTimeline: showInTimeline ?? true,
|
|
9689
|
+
_experimentalControls,
|
|
9690
|
+
_remotionInternalStack: stack,
|
|
9691
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive",
|
|
9692
|
+
_remotionInternalRefForOutline: refForOutline,
|
|
9693
|
+
children: React29.createElement(tag, {
|
|
9694
|
+
...props2,
|
|
9695
|
+
ref: callbackRef
|
|
9696
|
+
})
|
|
9697
|
+
});
|
|
9698
|
+
});
|
|
9699
|
+
Inner.displayName = displayName;
|
|
9700
|
+
const Wrapped = wrapInSchema({
|
|
9701
|
+
Component: Inner,
|
|
9702
|
+
schema: interactiveElementSchema,
|
|
9703
|
+
supportsEffects: false
|
|
9704
|
+
});
|
|
9705
|
+
Wrapped.displayName = displayName;
|
|
9706
|
+
addSequenceStackTraces(Wrapped);
|
|
9707
|
+
return Wrapped;
|
|
9708
|
+
};
|
|
9709
|
+
var Interactive = {
|
|
9710
|
+
A: makeInteractiveElement("a", "<Interactive.A>"),
|
|
9711
|
+
Article: makeInteractiveElement("article", "<Interactive.Article>"),
|
|
9712
|
+
Aside: makeInteractiveElement("aside", "<Interactive.Aside>"),
|
|
9713
|
+
Button: makeInteractiveElement("button", "<Interactive.Button>"),
|
|
9714
|
+
Circle: makeInteractiveElement("circle", "<Interactive.Circle>"),
|
|
9715
|
+
Code: makeInteractiveElement("code", "<Interactive.Code>"),
|
|
9716
|
+
Div: makeInteractiveElement("div", "<Interactive.Div>"),
|
|
9717
|
+
Ellipse: makeInteractiveElement("ellipse", "<Interactive.Ellipse>"),
|
|
9718
|
+
Em: makeInteractiveElement("em", "<Interactive.Em>"),
|
|
9719
|
+
Footer: makeInteractiveElement("footer", "<Interactive.Footer>"),
|
|
9720
|
+
G: makeInteractiveElement("g", "<Interactive.G>"),
|
|
9721
|
+
H1: makeInteractiveElement("h1", "<Interactive.H1>"),
|
|
9722
|
+
H2: makeInteractiveElement("h2", "<Interactive.H2>"),
|
|
9723
|
+
H3: makeInteractiveElement("h3", "<Interactive.H3>"),
|
|
9724
|
+
H4: makeInteractiveElement("h4", "<Interactive.H4>"),
|
|
9725
|
+
H5: makeInteractiveElement("h5", "<Interactive.H5>"),
|
|
9726
|
+
H6: makeInteractiveElement("h6", "<Interactive.H6>"),
|
|
9727
|
+
Header: makeInteractiveElement("header", "<Interactive.Header>"),
|
|
9728
|
+
Label: makeInteractiveElement("label", "<Interactive.Label>"),
|
|
9729
|
+
Li: makeInteractiveElement("li", "<Interactive.Li>"),
|
|
9730
|
+
Line: makeInteractiveElement("line", "<Interactive.Line>"),
|
|
9731
|
+
Main: makeInteractiveElement("main", "<Interactive.Main>"),
|
|
9732
|
+
Nav: makeInteractiveElement("nav", "<Interactive.Nav>"),
|
|
9733
|
+
Ol: makeInteractiveElement("ol", "<Interactive.Ol>"),
|
|
9734
|
+
P: makeInteractiveElement("p", "<Interactive.P>"),
|
|
9735
|
+
Path: makeInteractiveElement("path", "<Interactive.Path>"),
|
|
9736
|
+
Pre: makeInteractiveElement("pre", "<Interactive.Pre>"),
|
|
9737
|
+
Rect: makeInteractiveElement("rect", "<Interactive.Rect>"),
|
|
9738
|
+
Section: makeInteractiveElement("section", "<Interactive.Section>"),
|
|
9739
|
+
Small: makeInteractiveElement("small", "<Interactive.Small>"),
|
|
9740
|
+
Span: makeInteractiveElement("span", "<Interactive.Span>"),
|
|
9741
|
+
Strong: makeInteractiveElement("strong", "<Interactive.Strong>"),
|
|
9742
|
+
Svg: makeInteractiveElement("svg", "<Interactive.Svg>"),
|
|
9743
|
+
Text: makeInteractiveElement("text", "<Interactive.Text>"),
|
|
9744
|
+
Ul: makeInteractiveElement("ul", "<Interactive.Ul>")
|
|
9745
|
+
};
|
|
9205
9746
|
// src/internals.ts
|
|
9206
9747
|
import { createRef as createRef3 } from "react";
|
|
9207
9748
|
|
|
9208
9749
|
// src/CompositionManager.tsx
|
|
9209
|
-
import
|
|
9210
|
-
var compositionsRef =
|
|
9750
|
+
import React30 from "react";
|
|
9751
|
+
var compositionsRef = React30.createRef();
|
|
9211
9752
|
|
|
9212
9753
|
// src/CompositionManagerProvider.tsx
|
|
9213
9754
|
import {
|
|
9214
|
-
useCallback as
|
|
9755
|
+
useCallback as useCallback20,
|
|
9215
9756
|
useImperativeHandle as useImperativeHandle8,
|
|
9216
9757
|
useMemo as useMemo32,
|
|
9217
|
-
useRef as
|
|
9758
|
+
useRef as useRef26,
|
|
9218
9759
|
useState as useState18
|
|
9219
9760
|
} from "react";
|
|
9220
|
-
import { jsx as
|
|
9761
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
9221
9762
|
var CompositionManagerProvider = ({
|
|
9222
9763
|
children,
|
|
9223
9764
|
onlyRenderComposition,
|
|
@@ -9228,15 +9769,15 @@ var CompositionManagerProvider = ({
|
|
|
9228
9769
|
const [folders, setFolders] = useState18([]);
|
|
9229
9770
|
const [canvasContent, setCanvasContent] = useState18(initialCanvasContent);
|
|
9230
9771
|
const [compositions, setCompositions] = useState18(initialCompositions);
|
|
9231
|
-
const currentcompositionsRef =
|
|
9232
|
-
const updateCompositions =
|
|
9772
|
+
const currentcompositionsRef = useRef26(compositions);
|
|
9773
|
+
const updateCompositions = useCallback20((updateComps) => {
|
|
9233
9774
|
setCompositions((comps) => {
|
|
9234
9775
|
const updated = updateComps(comps);
|
|
9235
9776
|
currentcompositionsRef.current = updated;
|
|
9236
9777
|
return updated;
|
|
9237
9778
|
});
|
|
9238
9779
|
}, []);
|
|
9239
|
-
const registerComposition =
|
|
9780
|
+
const registerComposition = useCallback20((comp) => {
|
|
9240
9781
|
updateCompositions((comps) => {
|
|
9241
9782
|
if (comps.find((c2) => c2.id === comp.id)) {
|
|
9242
9783
|
throw new Error(`Multiple composition with id ${comp.id} are registered.`);
|
|
@@ -9244,12 +9785,12 @@ var CompositionManagerProvider = ({
|
|
|
9244
9785
|
return [...comps, comp];
|
|
9245
9786
|
});
|
|
9246
9787
|
}, [updateCompositions]);
|
|
9247
|
-
const unregisterComposition =
|
|
9788
|
+
const unregisterComposition = useCallback20((id) => {
|
|
9248
9789
|
setCompositions((comps) => {
|
|
9249
9790
|
return comps.filter((c2) => c2.id !== id);
|
|
9250
9791
|
});
|
|
9251
9792
|
}, []);
|
|
9252
|
-
const registerFolder =
|
|
9793
|
+
const registerFolder = useCallback20((name, parent, nonce, stack) => {
|
|
9253
9794
|
setFolders((prevFolders) => {
|
|
9254
9795
|
return [
|
|
9255
9796
|
...prevFolders,
|
|
@@ -9262,7 +9803,7 @@ var CompositionManagerProvider = ({
|
|
|
9262
9803
|
];
|
|
9263
9804
|
});
|
|
9264
9805
|
}, []);
|
|
9265
|
-
const unregisterFolder =
|
|
9806
|
+
const unregisterFolder = useCallback20((name, parent) => {
|
|
9266
9807
|
setFolders((prevFolders) => {
|
|
9267
9808
|
return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
|
|
9268
9809
|
});
|
|
@@ -9296,9 +9837,9 @@ var CompositionManagerProvider = ({
|
|
|
9296
9837
|
canvasContent
|
|
9297
9838
|
};
|
|
9298
9839
|
}, [compositions, folders, currentCompositionMetadata, canvasContent]);
|
|
9299
|
-
return /* @__PURE__ */
|
|
9840
|
+
return /* @__PURE__ */ jsx30(CompositionManager.Provider, {
|
|
9300
9841
|
value: compositionManagerContextValue,
|
|
9301
|
-
children: /* @__PURE__ */
|
|
9842
|
+
children: /* @__PURE__ */ jsx30(CompositionSetters.Provider, {
|
|
9302
9843
|
value: compositionManagerSetters,
|
|
9303
9844
|
children
|
|
9304
9845
|
})
|
|
@@ -9404,8 +9945,8 @@ var getPreviewDomElement = () => {
|
|
|
9404
9945
|
};
|
|
9405
9946
|
|
|
9406
9947
|
// src/max-video-cache-size.ts
|
|
9407
|
-
import
|
|
9408
|
-
var MaxMediaCacheSizeContext =
|
|
9948
|
+
import React31 from "react";
|
|
9949
|
+
var MaxMediaCacheSizeContext = React31.createContext(null);
|
|
9409
9950
|
|
|
9410
9951
|
// src/register-root.ts
|
|
9411
9952
|
var Root = null;
|
|
@@ -9443,7 +9984,7 @@ import { useMemo as useMemo34 } from "react";
|
|
|
9443
9984
|
|
|
9444
9985
|
// src/use-media-enabled.tsx
|
|
9445
9986
|
import { createContext as createContext24, useContext as useContext34, useMemo as useMemo33 } from "react";
|
|
9446
|
-
import { jsx as
|
|
9987
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
9447
9988
|
var MediaEnabledContext = createContext24(null);
|
|
9448
9989
|
var useVideoEnabled = () => {
|
|
9449
9990
|
const context = useContext34(MediaEnabledContext);
|
|
@@ -9471,14 +10012,14 @@ var MediaEnabledProvider = ({
|
|
|
9471
10012
|
audioEnabled
|
|
9472
10013
|
}) => {
|
|
9473
10014
|
const value = useMemo33(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
|
|
9474
|
-
return /* @__PURE__ */
|
|
10015
|
+
return /* @__PURE__ */ jsx31(MediaEnabledContext.Provider, {
|
|
9475
10016
|
value,
|
|
9476
10017
|
children
|
|
9477
10018
|
});
|
|
9478
10019
|
};
|
|
9479
10020
|
|
|
9480
10021
|
// src/RemotionRoot.tsx
|
|
9481
|
-
import { jsx as
|
|
10022
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
9482
10023
|
var RemotionRootContexts = ({
|
|
9483
10024
|
children,
|
|
9484
10025
|
numberOfAudioTags,
|
|
@@ -9498,25 +10039,25 @@ var RemotionRootContexts = ({
|
|
|
9498
10039
|
const logging = useMemo34(() => {
|
|
9499
10040
|
return { logLevel, mountTime: Date.now() };
|
|
9500
10041
|
}, [logLevel]);
|
|
9501
|
-
return /* @__PURE__ */
|
|
10042
|
+
return /* @__PURE__ */ jsx32(LogLevelContext.Provider, {
|
|
9502
10043
|
value: logging,
|
|
9503
|
-
children: /* @__PURE__ */
|
|
10044
|
+
children: /* @__PURE__ */ jsx32(NonceContext.Provider, {
|
|
9504
10045
|
value: nonceContext,
|
|
9505
|
-
children: /* @__PURE__ */
|
|
10046
|
+
children: /* @__PURE__ */ jsx32(TimelineContextProvider, {
|
|
9506
10047
|
frameState,
|
|
9507
|
-
children: /* @__PURE__ */
|
|
10048
|
+
children: /* @__PURE__ */ jsx32(MediaEnabledProvider, {
|
|
9508
10049
|
videoEnabled,
|
|
9509
10050
|
audioEnabled,
|
|
9510
|
-
children: /* @__PURE__ */
|
|
9511
|
-
children: /* @__PURE__ */
|
|
9512
|
-
children: /* @__PURE__ */
|
|
9513
|
-
children: /* @__PURE__ */
|
|
9514
|
-
children: /* @__PURE__ */
|
|
9515
|
-
children: /* @__PURE__ */
|
|
10051
|
+
children: /* @__PURE__ */ jsx32(EditorPropsProvider, {
|
|
10052
|
+
children: /* @__PURE__ */ jsx32(PrefetchProvider, {
|
|
10053
|
+
children: /* @__PURE__ */ jsx32(SequenceManagerProvider, {
|
|
10054
|
+
children: /* @__PURE__ */ jsx32(DurationsContextProvider, {
|
|
10055
|
+
children: /* @__PURE__ */ jsx32(BufferingProvider, {
|
|
10056
|
+
children: /* @__PURE__ */ jsx32(SharedAudioContextProvider, {
|
|
9516
10057
|
audioLatencyHint,
|
|
9517
10058
|
audioEnabled,
|
|
9518
10059
|
previewSampleRate,
|
|
9519
|
-
children: /* @__PURE__ */
|
|
10060
|
+
children: /* @__PURE__ */ jsx32(SharedAudioTagsContextProvider, {
|
|
9520
10061
|
numberOfAudioTags,
|
|
9521
10062
|
children
|
|
9522
10063
|
})
|
|
@@ -9710,8 +10251,8 @@ var resolveVideoConfigOrCatch = (params) => {
|
|
|
9710
10251
|
};
|
|
9711
10252
|
|
|
9712
10253
|
// src/sequence-stack-traces.ts
|
|
9713
|
-
import
|
|
9714
|
-
var SequenceStackTracesUpdateContext =
|
|
10254
|
+
import React33 from "react";
|
|
10255
|
+
var SequenceStackTracesUpdateContext = React33.createContext(() => {});
|
|
9715
10256
|
|
|
9716
10257
|
// src/setup-env-variables.ts
|
|
9717
10258
|
var getEnvVariables = () => {
|
|
@@ -9741,8 +10282,8 @@ var setupEnvVariables = () => {
|
|
|
9741
10282
|
};
|
|
9742
10283
|
|
|
9743
10284
|
// src/use-current-scale.ts
|
|
9744
|
-
import
|
|
9745
|
-
var CurrentScaleContext =
|
|
10285
|
+
import React34, { createContext as createContext25 } from "react";
|
|
10286
|
+
var CurrentScaleContext = React34.createContext(null);
|
|
9746
10287
|
var PreviewSizeContext = createContext25({
|
|
9747
10288
|
setSize: () => {
|
|
9748
10289
|
return;
|
|
@@ -9767,8 +10308,8 @@ var calculateScale = ({
|
|
|
9767
10308
|
return Number(previewSize);
|
|
9768
10309
|
};
|
|
9769
10310
|
var useCurrentScale = (options) => {
|
|
9770
|
-
const hasContext =
|
|
9771
|
-
const zoomContext =
|
|
10311
|
+
const hasContext = React34.useContext(CurrentScaleContext);
|
|
10312
|
+
const zoomContext = React34.useContext(PreviewSizeContext);
|
|
9772
10313
|
const config = useUnsafeVideoConfig();
|
|
9773
10314
|
const env = useRemotionEnvironment();
|
|
9774
10315
|
if (hasContext === null || config === null || zoomContext === null) {
|
|
@@ -9798,8 +10339,8 @@ var useCurrentScale = (options) => {
|
|
|
9798
10339
|
};
|
|
9799
10340
|
|
|
9800
10341
|
// src/use-pixel-density.ts
|
|
9801
|
-
import
|
|
9802
|
-
var PixelDensityContext =
|
|
10342
|
+
import React35, { useContext as useContext35 } from "react";
|
|
10343
|
+
var PixelDensityContext = React35.createContext(null);
|
|
9803
10344
|
var getBrowserPixelDensity = () => {
|
|
9804
10345
|
if (typeof window === "undefined") {
|
|
9805
10346
|
return 1;
|
|
@@ -9825,11 +10366,11 @@ var usePixelDensity = (options) => {
|
|
|
9825
10366
|
};
|
|
9826
10367
|
|
|
9827
10368
|
// src/video/OffthreadVideo.tsx
|
|
9828
|
-
import { useCallback as
|
|
10369
|
+
import { useCallback as useCallback23 } from "react";
|
|
9829
10370
|
|
|
9830
10371
|
// src/video/OffthreadVideoForRendering.tsx
|
|
9831
10372
|
import {
|
|
9832
|
-
useCallback as
|
|
10373
|
+
useCallback as useCallback21,
|
|
9833
10374
|
useContext as useContext36,
|
|
9834
10375
|
useEffect as useEffect18,
|
|
9835
10376
|
useLayoutEffect as useLayoutEffect11,
|
|
@@ -9848,7 +10389,7 @@ var getOffthreadVideoSource = ({
|
|
|
9848
10389
|
};
|
|
9849
10390
|
|
|
9850
10391
|
// src/video/OffthreadVideoForRendering.tsx
|
|
9851
|
-
import { jsx as
|
|
10392
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
9852
10393
|
var OffthreadVideoForRendering = ({
|
|
9853
10394
|
onError,
|
|
9854
10395
|
volume: volumeProp,
|
|
@@ -10022,7 +10563,7 @@ var OffthreadVideoForRendering = ({
|
|
|
10022
10563
|
continueRender2,
|
|
10023
10564
|
delayRender2
|
|
10024
10565
|
]);
|
|
10025
|
-
const onErr =
|
|
10566
|
+
const onErr = useCallback21(() => {
|
|
10026
10567
|
if (onError) {
|
|
10027
10568
|
onError?.(new Error("Failed to load image with src " + imageSrc));
|
|
10028
10569
|
} else {
|
|
@@ -10032,7 +10573,7 @@ var OffthreadVideoForRendering = ({
|
|
|
10032
10573
|
const className = useMemo35(() => {
|
|
10033
10574
|
return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
|
|
10034
10575
|
}, [props2.className]);
|
|
10035
|
-
const onImageFrame =
|
|
10576
|
+
const onImageFrame = useCallback21((img) => {
|
|
10036
10577
|
if (onVideoFrame) {
|
|
10037
10578
|
onVideoFrame(img);
|
|
10038
10579
|
}
|
|
@@ -10041,7 +10582,7 @@ var OffthreadVideoForRendering = ({
|
|
|
10041
10582
|
return null;
|
|
10042
10583
|
}
|
|
10043
10584
|
continueRender2(imageSrc.handle);
|
|
10044
|
-
return /* @__PURE__ */
|
|
10585
|
+
return /* @__PURE__ */ jsx33(Img, {
|
|
10045
10586
|
src: imageSrc.src,
|
|
10046
10587
|
delayRenderRetries,
|
|
10047
10588
|
delayRenderTimeoutInMilliseconds,
|
|
@@ -10053,14 +10594,14 @@ var OffthreadVideoForRendering = ({
|
|
|
10053
10594
|
};
|
|
10054
10595
|
|
|
10055
10596
|
// src/video/VideoForPreview.tsx
|
|
10056
|
-
import
|
|
10057
|
-
forwardRef as
|
|
10058
|
-
useCallback as
|
|
10597
|
+
import React37, {
|
|
10598
|
+
forwardRef as forwardRef13,
|
|
10599
|
+
useCallback as useCallback22,
|
|
10059
10600
|
useContext as useContext37,
|
|
10060
10601
|
useEffect as useEffect20,
|
|
10061
10602
|
useImperativeHandle as useImperativeHandle9,
|
|
10062
10603
|
useMemo as useMemo36,
|
|
10063
|
-
useRef as
|
|
10604
|
+
useRef as useRef27,
|
|
10064
10605
|
useState as useState20
|
|
10065
10606
|
} from "react";
|
|
10066
10607
|
|
|
@@ -10110,13 +10651,13 @@ class MediaPlaybackError extends Error {
|
|
|
10110
10651
|
}
|
|
10111
10652
|
|
|
10112
10653
|
// src/video/VideoForPreview.tsx
|
|
10113
|
-
import { jsx as
|
|
10654
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
10114
10655
|
var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
10115
10656
|
const context = useContext37(SharedAudioContext);
|
|
10116
10657
|
if (!context) {
|
|
10117
10658
|
throw new Error("SharedAudioContext not found");
|
|
10118
10659
|
}
|
|
10119
|
-
const videoRef =
|
|
10660
|
+
const videoRef = useRef27(null);
|
|
10120
10661
|
const sharedSource = useMemo36(() => {
|
|
10121
10662
|
if (!context.audioContext) {
|
|
10122
10663
|
return null;
|
|
@@ -10126,7 +10667,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
10126
10667
|
ref: videoRef
|
|
10127
10668
|
});
|
|
10128
10669
|
}, [context.audioContext]);
|
|
10129
|
-
const effectToUse =
|
|
10670
|
+
const effectToUse = React37.useInsertionEffect ?? React37.useLayoutEffect;
|
|
10130
10671
|
effectToUse(() => {
|
|
10131
10672
|
return () => {
|
|
10132
10673
|
requestAnimationFrame(() => {
|
|
@@ -10184,7 +10725,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
10184
10725
|
mediaVolume
|
|
10185
10726
|
});
|
|
10186
10727
|
warnAboutTooHighVolume(userPreferredVolume);
|
|
10187
|
-
const getStack =
|
|
10728
|
+
const getStack = useCallback22(() => {
|
|
10188
10729
|
return _remotionInternalStack ?? null;
|
|
10189
10730
|
}, [_remotionInternalStack]);
|
|
10190
10731
|
useMediaInTimeline({
|
|
@@ -10200,7 +10741,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
10200
10741
|
premountDisplay: parentSequence?.premountDisplay ?? null,
|
|
10201
10742
|
postmountDisplay: parentSequence?.postmountDisplay ?? null,
|
|
10202
10743
|
loopDisplay: undefined,
|
|
10203
|
-
documentationLink:
|
|
10744
|
+
documentationLink: onlyWarnForMediaSeekingError ? "https://www.remotion.dev/docs/offthreadvideo" : "https://www.remotion.dev/docs/html5-video",
|
|
10204
10745
|
refForOutline: videoRef
|
|
10205
10746
|
});
|
|
10206
10747
|
useMediaPlayback({
|
|
@@ -10289,7 +10830,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
10289
10830
|
current.removeEventListener("error", errorHandler);
|
|
10290
10831
|
};
|
|
10291
10832
|
}, [onError, src]);
|
|
10292
|
-
const currentOnDurationCallback =
|
|
10833
|
+
const currentOnDurationCallback = useRef27(onDuration);
|
|
10293
10834
|
currentOnDurationCallback.current = onDuration;
|
|
10294
10835
|
useEmitVideoFrame({ ref: videoRef, onVideoFrame });
|
|
10295
10836
|
useEffect20(() => {
|
|
@@ -10330,7 +10871,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
10330
10871
|
requestsVideoFrame: Boolean(onVideoFrame),
|
|
10331
10872
|
isClientSideRendering: false
|
|
10332
10873
|
});
|
|
10333
|
-
return /* @__PURE__ */
|
|
10874
|
+
return /* @__PURE__ */ jsx34("video", {
|
|
10875
|
+
...nativeProps,
|
|
10334
10876
|
ref: videoRef,
|
|
10335
10877
|
muted: muted || mediaMuted || userPreferredVolume <= 0,
|
|
10336
10878
|
playsInline: true,
|
|
@@ -10339,13 +10881,13 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
|
|
|
10339
10881
|
style: actualStyle,
|
|
10340
10882
|
disableRemotePlayback: true,
|
|
10341
10883
|
crossOrigin: crossOriginValue,
|
|
10342
|
-
|
|
10884
|
+
controls: false
|
|
10343
10885
|
});
|
|
10344
10886
|
};
|
|
10345
|
-
var VideoForPreview =
|
|
10887
|
+
var VideoForPreview = forwardRef13(VideoForDevelopmentRefForwardingFunction);
|
|
10346
10888
|
|
|
10347
10889
|
// src/video/OffthreadVideo.tsx
|
|
10348
|
-
import { jsx as
|
|
10890
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
10349
10891
|
var InnerOffthreadVideo = (props2) => {
|
|
10350
10892
|
const {
|
|
10351
10893
|
startFrom,
|
|
@@ -10362,7 +10904,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
10362
10904
|
if (environment.isClientSideRendering) {
|
|
10363
10905
|
throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
|
|
10364
10906
|
}
|
|
10365
|
-
const onDuration =
|
|
10907
|
+
const onDuration = useCallback23(() => {
|
|
10366
10908
|
return;
|
|
10367
10909
|
}, []);
|
|
10368
10910
|
if (typeof props2.src !== "string") {
|
|
@@ -10376,13 +10918,13 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
10376
10918
|
trimAfter
|
|
10377
10919
|
});
|
|
10378
10920
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
10379
|
-
return /* @__PURE__ */
|
|
10921
|
+
return /* @__PURE__ */ jsx35(Sequence, {
|
|
10380
10922
|
layout: "none",
|
|
10381
10923
|
from: 0 - (trimBeforeValue ?? 0),
|
|
10382
10924
|
showInTimeline: false,
|
|
10383
10925
|
durationInFrames: trimAfterValue,
|
|
10384
10926
|
name,
|
|
10385
|
-
children: /* @__PURE__ */
|
|
10927
|
+
children: /* @__PURE__ */ jsx35(InnerOffthreadVideo, {
|
|
10386
10928
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
10387
10929
|
...otherProps,
|
|
10388
10930
|
trimAfter: undefined,
|
|
@@ -10397,7 +10939,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
10397
10939
|
}
|
|
10398
10940
|
validateMediaProps(props2, "Video");
|
|
10399
10941
|
if (environment.isRendering) {
|
|
10400
|
-
return /* @__PURE__ */
|
|
10942
|
+
return /* @__PURE__ */ jsx35(OffthreadVideoForRendering, {
|
|
10401
10943
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
10402
10944
|
...otherProps,
|
|
10403
10945
|
trimAfter: undefined,
|
|
@@ -10419,7 +10961,7 @@ var InnerOffthreadVideo = (props2) => {
|
|
|
10419
10961
|
delayRenderTimeoutInMilliseconds,
|
|
10420
10962
|
...propsForPreview
|
|
10421
10963
|
} = otherProps;
|
|
10422
|
-
return /* @__PURE__ */
|
|
10964
|
+
return /* @__PURE__ */ jsx35(VideoForPreview, {
|
|
10423
10965
|
_remotionInternalStack: stack ?? null,
|
|
10424
10966
|
onDuration,
|
|
10425
10967
|
onlyWarnForMediaSeekingError: true,
|
|
@@ -10468,7 +11010,7 @@ var OffthreadVideo = ({
|
|
|
10468
11010
|
if (imageFormat) {
|
|
10469
11011
|
throw new TypeError(`The \`<OffthreadVideo>\` tag does no longer accept \`imageFormat\`. Use the \`transparent\` prop if you want to render a transparent video.`);
|
|
10470
11012
|
}
|
|
10471
|
-
return /* @__PURE__ */
|
|
11013
|
+
return /* @__PURE__ */ jsx35(InnerOffthreadVideo, {
|
|
10472
11014
|
acceptableTimeShiftInSeconds,
|
|
10473
11015
|
allowAmplificationDuringRender: allowAmplificationDuringRender ?? true,
|
|
10474
11016
|
audioStreamIndex: audioStreamIndex ?? 0,
|
|
@@ -10541,23 +11083,23 @@ var watchStaticFile = (fileName, callback) => {
|
|
|
10541
11083
|
};
|
|
10542
11084
|
|
|
10543
11085
|
// src/wrap-remotion-context.tsx
|
|
10544
|
-
import
|
|
10545
|
-
import { jsx as
|
|
11086
|
+
import React39, { useMemo as useMemo37 } from "react";
|
|
11087
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
10546
11088
|
function useRemotionContexts() {
|
|
10547
|
-
const compositionManagerCtx =
|
|
10548
|
-
const timelineContext =
|
|
10549
|
-
const setTimelineContext =
|
|
10550
|
-
const sequenceContext =
|
|
10551
|
-
const nonceContext =
|
|
10552
|
-
const canUseRemotionHooksContext =
|
|
10553
|
-
const preloadContext =
|
|
10554
|
-
const resolveCompositionContext =
|
|
10555
|
-
const renderAssetManagerContext =
|
|
10556
|
-
const sequenceManagerContext =
|
|
10557
|
-
const sequenceManagerRefContext =
|
|
10558
|
-
const visualModePropStatusesRefContext =
|
|
10559
|
-
const bufferManagerContext =
|
|
10560
|
-
const logLevelContext =
|
|
11089
|
+
const compositionManagerCtx = React39.useContext(CompositionManager);
|
|
11090
|
+
const timelineContext = React39.useContext(TimelineContext);
|
|
11091
|
+
const setTimelineContext = React39.useContext(SetTimelineContext);
|
|
11092
|
+
const sequenceContext = React39.useContext(SequenceContext);
|
|
11093
|
+
const nonceContext = React39.useContext(NonceContext);
|
|
11094
|
+
const canUseRemotionHooksContext = React39.useContext(CanUseRemotionHooks);
|
|
11095
|
+
const preloadContext = React39.useContext(PreloadContext);
|
|
11096
|
+
const resolveCompositionContext = React39.useContext(ResolveCompositionContext);
|
|
11097
|
+
const renderAssetManagerContext = React39.useContext(RenderAssetManager);
|
|
11098
|
+
const sequenceManagerContext = React39.useContext(SequenceManager);
|
|
11099
|
+
const sequenceManagerRefContext = React39.useContext(SequenceManagerRefContext);
|
|
11100
|
+
const visualModePropStatusesRefContext = React39.useContext(VisualModePropStatusesRefContext);
|
|
11101
|
+
const bufferManagerContext = React39.useContext(BufferingContextReact);
|
|
11102
|
+
const logLevelContext = React39.useContext(LogLevelContext);
|
|
10561
11103
|
return useMemo37(() => ({
|
|
10562
11104
|
compositionManagerCtx,
|
|
10563
11105
|
timelineContext,
|
|
@@ -10592,33 +11134,33 @@ function useRemotionContexts() {
|
|
|
10592
11134
|
}
|
|
10593
11135
|
var RemotionContextProvider = (props2) => {
|
|
10594
11136
|
const { children, contexts } = props2;
|
|
10595
|
-
return /* @__PURE__ */
|
|
11137
|
+
return /* @__PURE__ */ jsx36(LogLevelContext.Provider, {
|
|
10596
11138
|
value: contexts.logLevelContext,
|
|
10597
|
-
children: /* @__PURE__ */
|
|
11139
|
+
children: /* @__PURE__ */ jsx36(CanUseRemotionHooks.Provider, {
|
|
10598
11140
|
value: contexts.canUseRemotionHooksContext,
|
|
10599
|
-
children: /* @__PURE__ */
|
|
11141
|
+
children: /* @__PURE__ */ jsx36(NonceContext.Provider, {
|
|
10600
11142
|
value: contexts.nonceContext,
|
|
10601
|
-
children: /* @__PURE__ */
|
|
11143
|
+
children: /* @__PURE__ */ jsx36(PreloadContext.Provider, {
|
|
10602
11144
|
value: contexts.preloadContext,
|
|
10603
|
-
children: /* @__PURE__ */
|
|
11145
|
+
children: /* @__PURE__ */ jsx36(CompositionManager.Provider, {
|
|
10604
11146
|
value: contexts.compositionManagerCtx,
|
|
10605
|
-
children: /* @__PURE__ */
|
|
11147
|
+
children: /* @__PURE__ */ jsx36(SequenceManagerRefContext.Provider, {
|
|
10606
11148
|
value: contexts.sequenceManagerRefContext,
|
|
10607
|
-
children: /* @__PURE__ */
|
|
11149
|
+
children: /* @__PURE__ */ jsx36(SequenceManager.Provider, {
|
|
10608
11150
|
value: contexts.sequenceManagerContext,
|
|
10609
|
-
children: /* @__PURE__ */
|
|
11151
|
+
children: /* @__PURE__ */ jsx36(VisualModePropStatusesRefContext.Provider, {
|
|
10610
11152
|
value: contexts.visualModePropStatusesRefContext,
|
|
10611
|
-
children: /* @__PURE__ */
|
|
11153
|
+
children: /* @__PURE__ */ jsx36(RenderAssetManager.Provider, {
|
|
10612
11154
|
value: contexts.renderAssetManagerContext,
|
|
10613
|
-
children: /* @__PURE__ */
|
|
11155
|
+
children: /* @__PURE__ */ jsx36(ResolveCompositionContext.Provider, {
|
|
10614
11156
|
value: contexts.resolveCompositionContext,
|
|
10615
|
-
children: /* @__PURE__ */
|
|
11157
|
+
children: /* @__PURE__ */ jsx36(TimelineContext.Provider, {
|
|
10616
11158
|
value: contexts.timelineContext,
|
|
10617
|
-
children: /* @__PURE__ */
|
|
11159
|
+
children: /* @__PURE__ */ jsx36(SetTimelineContext.Provider, {
|
|
10618
11160
|
value: contexts.setTimelineContext,
|
|
10619
|
-
children: /* @__PURE__ */
|
|
11161
|
+
children: /* @__PURE__ */ jsx36(SequenceContext.Provider, {
|
|
10620
11162
|
value: contexts.sequenceContext,
|
|
10621
|
-
children: /* @__PURE__ */
|
|
11163
|
+
children: /* @__PURE__ */ jsx36(BufferingContextReact.Provider, {
|
|
10622
11164
|
value: contexts.bufferManagerContext,
|
|
10623
11165
|
children
|
|
10624
11166
|
})
|
|
@@ -10778,51 +11320,26 @@ var Internals = {
|
|
|
10778
11320
|
OverrideIdsToNodePathsGettersContext,
|
|
10779
11321
|
OverrideIdsToNodePathsSettersContext,
|
|
10780
11322
|
findPropsToDelete,
|
|
10781
|
-
makeSequencePropsSubscriptionKey,
|
|
10782
|
-
getPropStatusesCtx,
|
|
10783
|
-
getEffectPropStatusesCtx,
|
|
10784
|
-
hiddenField,
|
|
10785
|
-
durationInFramesField,
|
|
10786
|
-
fromField
|
|
10787
|
-
};
|
|
10788
|
-
// src/validate-frame.ts
|
|
10789
|
-
var validateFrame = ({
|
|
10790
|
-
allowFloats,
|
|
10791
|
-
durationInFrames,
|
|
10792
|
-
frame
|
|
10793
|
-
}) => {
|
|
10794
|
-
if (typeof frame === "undefined") {
|
|
10795
|
-
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
10796
|
-
}
|
|
10797
|
-
if (typeof frame !== "number") {
|
|
10798
|
-
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
10799
|
-
}
|
|
10800
|
-
if (!Number.isFinite(frame)) {
|
|
10801
|
-
throw new RangeError(`Frame ${frame} is not finite`);
|
|
10802
|
-
}
|
|
10803
|
-
if (frame % 1 !== 0 && !allowFloats) {
|
|
10804
|
-
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
10805
|
-
}
|
|
10806
|
-
if (frame < 0 && frame < -durationInFrames) {
|
|
10807
|
-
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
10808
|
-
}
|
|
10809
|
-
if (frame > durationInFrames - 1) {
|
|
10810
|
-
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
10811
|
-
}
|
|
11323
|
+
makeSequencePropsSubscriptionKey,
|
|
11324
|
+
getPropStatusesCtx,
|
|
11325
|
+
getEffectPropStatusesCtx,
|
|
11326
|
+
hiddenField,
|
|
11327
|
+
durationInFramesField,
|
|
11328
|
+
fromField
|
|
10812
11329
|
};
|
|
10813
11330
|
// src/series/index.tsx
|
|
10814
11331
|
import {
|
|
10815
11332
|
Children,
|
|
10816
|
-
forwardRef as
|
|
11333
|
+
forwardRef as forwardRef14,
|
|
10817
11334
|
useMemo as useMemo38
|
|
10818
11335
|
} from "react";
|
|
10819
11336
|
|
|
10820
11337
|
// src/series/flatten-children.tsx
|
|
10821
|
-
import
|
|
11338
|
+
import React40 from "react";
|
|
10822
11339
|
var flattenChildren = (children) => {
|
|
10823
|
-
const childrenArray =
|
|
11340
|
+
const childrenArray = React40.Children.toArray(children);
|
|
10824
11341
|
return childrenArray.reduce((flatChildren, child) => {
|
|
10825
|
-
if (child.type ===
|
|
11342
|
+
if (child.type === React40.Fragment) {
|
|
10826
11343
|
return flatChildren.concat(flattenChildren(child.props.children));
|
|
10827
11344
|
}
|
|
10828
11345
|
flatChildren.push(child);
|
|
@@ -10831,14 +11348,14 @@ var flattenChildren = (children) => {
|
|
|
10831
11348
|
};
|
|
10832
11349
|
|
|
10833
11350
|
// src/series/index.tsx
|
|
10834
|
-
import { jsx as
|
|
11351
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
10835
11352
|
var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
|
|
10836
11353
|
useRequireToBeInsideSeries();
|
|
10837
|
-
return /* @__PURE__ */
|
|
11354
|
+
return /* @__PURE__ */ jsx37(IsNotInsideSeriesProvider, {
|
|
10838
11355
|
children
|
|
10839
11356
|
});
|
|
10840
11357
|
};
|
|
10841
|
-
var SeriesSequence =
|
|
11358
|
+
var SeriesSequence = forwardRef14(SeriesSequenceRefForwardingFunction);
|
|
10842
11359
|
var SequenceWithoutSchemaWithRef = SequenceWithoutSchema;
|
|
10843
11360
|
var SeriesInner = (props2) => {
|
|
10844
11361
|
const childrenValue = useMemo38(() => {
|
|
@@ -10882,7 +11399,7 @@ var SeriesInner = (props2) => {
|
|
|
10882
11399
|
}
|
|
10883
11400
|
const currentStartFrame = startFrame + offset;
|
|
10884
11401
|
startFrame += durationInFramesProp + offset;
|
|
10885
|
-
return /* @__PURE__ */
|
|
11402
|
+
return /* @__PURE__ */ jsx37(SequenceWithoutSchemaWithRef, {
|
|
10886
11403
|
ref: castedChild.ref,
|
|
10887
11404
|
name: name || "<Series.Sequence>",
|
|
10888
11405
|
_remotionInternalDocumentationLink: name ? undefined : "https://www.remotion.dev/docs/series",
|
|
@@ -10893,8 +11410,8 @@ var SeriesInner = (props2) => {
|
|
|
10893
11410
|
});
|
|
10894
11411
|
});
|
|
10895
11412
|
}, [props2.children]);
|
|
10896
|
-
return /* @__PURE__ */
|
|
10897
|
-
children: /* @__PURE__ */
|
|
11413
|
+
return /* @__PURE__ */ jsx37(IsInsideSeriesContainer, {
|
|
11414
|
+
children: /* @__PURE__ */ jsx37(Sequence, {
|
|
10898
11415
|
layout: "none",
|
|
10899
11416
|
name: "<Series>",
|
|
10900
11417
|
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/series",
|
|
@@ -10911,247 +11428,6 @@ var Series = Object.assign(wrapInSchema({
|
|
|
10911
11428
|
Sequence: SeriesSequence
|
|
10912
11429
|
});
|
|
10913
11430
|
addSequenceStackTraces(Series);
|
|
10914
|
-
// src/validation/validation-spring-duration.ts
|
|
10915
|
-
var validateSpringDuration = (dur) => {
|
|
10916
|
-
if (typeof dur === "undefined") {
|
|
10917
|
-
return;
|
|
10918
|
-
}
|
|
10919
|
-
if (typeof dur !== "number") {
|
|
10920
|
-
throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof dur}"`);
|
|
10921
|
-
}
|
|
10922
|
-
if (Number.isNaN(dur)) {
|
|
10923
|
-
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
10924
|
-
}
|
|
10925
|
-
if (!Number.isFinite(dur)) {
|
|
10926
|
-
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
10927
|
-
}
|
|
10928
|
-
if (dur <= 0) {
|
|
10929
|
-
throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
|
|
10930
|
-
}
|
|
10931
|
-
};
|
|
10932
|
-
|
|
10933
|
-
// src/spring/spring-utils.ts
|
|
10934
|
-
var defaultSpringConfig = {
|
|
10935
|
-
damping: 10,
|
|
10936
|
-
mass: 1,
|
|
10937
|
-
stiffness: 100,
|
|
10938
|
-
overshootClamping: false
|
|
10939
|
-
};
|
|
10940
|
-
var advanceCache = {};
|
|
10941
|
-
function advance({
|
|
10942
|
-
animation,
|
|
10943
|
-
now,
|
|
10944
|
-
config
|
|
10945
|
-
}) {
|
|
10946
|
-
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
10947
|
-
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
10948
|
-
if (config.damping <= 0) {
|
|
10949
|
-
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
10950
|
-
}
|
|
10951
|
-
const c2 = config.damping;
|
|
10952
|
-
const m = config.mass;
|
|
10953
|
-
const k = config.stiffness;
|
|
10954
|
-
const cacheKey = [
|
|
10955
|
-
toValue,
|
|
10956
|
-
lastTimestamp,
|
|
10957
|
-
current,
|
|
10958
|
-
velocity,
|
|
10959
|
-
c2,
|
|
10960
|
-
m,
|
|
10961
|
-
k,
|
|
10962
|
-
now
|
|
10963
|
-
].join("-");
|
|
10964
|
-
if (advanceCache[cacheKey]) {
|
|
10965
|
-
return advanceCache[cacheKey];
|
|
10966
|
-
}
|
|
10967
|
-
const v0 = -velocity;
|
|
10968
|
-
const x0 = toValue - current;
|
|
10969
|
-
const zeta = c2 / (2 * Math.sqrt(k * m));
|
|
10970
|
-
const omega0 = Math.sqrt(k / m);
|
|
10971
|
-
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
10972
|
-
const t = deltaTime / 1000;
|
|
10973
|
-
const sin1 = Math.sin(omega1 * t);
|
|
10974
|
-
const cos1 = Math.cos(omega1 * t);
|
|
10975
|
-
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
10976
|
-
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
10977
|
-
const underDampedPosition = toValue - underDampedFrag1;
|
|
10978
|
-
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
10979
|
-
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
10980
|
-
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
10981
|
-
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
10982
|
-
const animationNode = {
|
|
10983
|
-
toValue,
|
|
10984
|
-
prevPosition: current,
|
|
10985
|
-
lastTimestamp: now,
|
|
10986
|
-
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
10987
|
-
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
10988
|
-
};
|
|
10989
|
-
advanceCache[cacheKey] = animationNode;
|
|
10990
|
-
return animationNode;
|
|
10991
|
-
}
|
|
10992
|
-
var calculationCache = {};
|
|
10993
|
-
function springCalculation({
|
|
10994
|
-
frame,
|
|
10995
|
-
fps,
|
|
10996
|
-
config = {}
|
|
10997
|
-
}) {
|
|
10998
|
-
const from = 0;
|
|
10999
|
-
const to = 1;
|
|
11000
|
-
const cacheKey = [
|
|
11001
|
-
frame,
|
|
11002
|
-
fps,
|
|
11003
|
-
config.damping,
|
|
11004
|
-
config.mass,
|
|
11005
|
-
config.overshootClamping,
|
|
11006
|
-
config.stiffness
|
|
11007
|
-
].join("-");
|
|
11008
|
-
if (calculationCache[cacheKey]) {
|
|
11009
|
-
return calculationCache[cacheKey];
|
|
11010
|
-
}
|
|
11011
|
-
let animation = {
|
|
11012
|
-
lastTimestamp: 0,
|
|
11013
|
-
current: from,
|
|
11014
|
-
toValue: to,
|
|
11015
|
-
velocity: 0,
|
|
11016
|
-
prevPosition: 0
|
|
11017
|
-
};
|
|
11018
|
-
const frameClamped = Math.max(0, frame);
|
|
11019
|
-
const unevenRest = frameClamped % 1;
|
|
11020
|
-
for (let f = 0;f <= Math.floor(frameClamped); f++) {
|
|
11021
|
-
if (f === Math.floor(frameClamped)) {
|
|
11022
|
-
f += unevenRest;
|
|
11023
|
-
}
|
|
11024
|
-
const time = f / fps * 1000;
|
|
11025
|
-
animation = advance({
|
|
11026
|
-
animation,
|
|
11027
|
-
now: time,
|
|
11028
|
-
config: {
|
|
11029
|
-
...defaultSpringConfig,
|
|
11030
|
-
...config
|
|
11031
|
-
}
|
|
11032
|
-
});
|
|
11033
|
-
}
|
|
11034
|
-
calculationCache[cacheKey] = animation;
|
|
11035
|
-
return animation;
|
|
11036
|
-
}
|
|
11037
|
-
|
|
11038
|
-
// src/spring/measure-spring.ts
|
|
11039
|
-
var cache = new Map;
|
|
11040
|
-
function measureSpring({
|
|
11041
|
-
fps,
|
|
11042
|
-
config = {},
|
|
11043
|
-
threshold = 0.005
|
|
11044
|
-
}) {
|
|
11045
|
-
if (typeof threshold !== "number") {
|
|
11046
|
-
throw new TypeError(`threshold must be a number, got ${threshold} of type ${typeof threshold}`);
|
|
11047
|
-
}
|
|
11048
|
-
if (threshold === 0) {
|
|
11049
|
-
return Infinity;
|
|
11050
|
-
}
|
|
11051
|
-
if (threshold === 1) {
|
|
11052
|
-
return 0;
|
|
11053
|
-
}
|
|
11054
|
-
if (isNaN(threshold)) {
|
|
11055
|
-
throw new TypeError("Threshold is NaN");
|
|
11056
|
-
}
|
|
11057
|
-
if (!Number.isFinite(threshold)) {
|
|
11058
|
-
throw new TypeError("Threshold is not finite");
|
|
11059
|
-
}
|
|
11060
|
-
if (threshold < 0) {
|
|
11061
|
-
throw new TypeError("Threshold is below 0");
|
|
11062
|
-
}
|
|
11063
|
-
const cacheKey = [
|
|
11064
|
-
fps,
|
|
11065
|
-
config.damping,
|
|
11066
|
-
config.mass,
|
|
11067
|
-
config.overshootClamping,
|
|
11068
|
-
config.stiffness,
|
|
11069
|
-
threshold
|
|
11070
|
-
].join("-");
|
|
11071
|
-
if (cache.has(cacheKey)) {
|
|
11072
|
-
return cache.get(cacheKey);
|
|
11073
|
-
}
|
|
11074
|
-
validateFps(fps, "to the measureSpring() function", false);
|
|
11075
|
-
let frame = 0;
|
|
11076
|
-
let finishedFrame = 0;
|
|
11077
|
-
const calc = () => {
|
|
11078
|
-
return springCalculation({
|
|
11079
|
-
fps,
|
|
11080
|
-
frame,
|
|
11081
|
-
config
|
|
11082
|
-
});
|
|
11083
|
-
};
|
|
11084
|
-
let animation = calc();
|
|
11085
|
-
const calcDifference = () => {
|
|
11086
|
-
return Math.abs(animation.current - animation.toValue);
|
|
11087
|
-
};
|
|
11088
|
-
let difference = calcDifference();
|
|
11089
|
-
while (difference >= threshold) {
|
|
11090
|
-
frame++;
|
|
11091
|
-
animation = calc();
|
|
11092
|
-
difference = calcDifference();
|
|
11093
|
-
}
|
|
11094
|
-
finishedFrame = frame;
|
|
11095
|
-
for (let i = 0;i < 20; i++) {
|
|
11096
|
-
frame++;
|
|
11097
|
-
animation = calc();
|
|
11098
|
-
difference = calcDifference();
|
|
11099
|
-
if (difference >= threshold) {
|
|
11100
|
-
i = 0;
|
|
11101
|
-
finishedFrame = frame + 1;
|
|
11102
|
-
}
|
|
11103
|
-
}
|
|
11104
|
-
cache.set(cacheKey, finishedFrame);
|
|
11105
|
-
return finishedFrame;
|
|
11106
|
-
}
|
|
11107
|
-
|
|
11108
|
-
// src/spring/index.ts
|
|
11109
|
-
function spring({
|
|
11110
|
-
frame: passedFrame,
|
|
11111
|
-
fps,
|
|
11112
|
-
config = {},
|
|
11113
|
-
from = 0,
|
|
11114
|
-
to = 1,
|
|
11115
|
-
durationInFrames: passedDurationInFrames,
|
|
11116
|
-
durationRestThreshold,
|
|
11117
|
-
delay = 0,
|
|
11118
|
-
reverse = false
|
|
11119
|
-
}) {
|
|
11120
|
-
validateSpringDuration(passedDurationInFrames);
|
|
11121
|
-
validateFrame({
|
|
11122
|
-
frame: passedFrame,
|
|
11123
|
-
durationInFrames: Infinity,
|
|
11124
|
-
allowFloats: true
|
|
11125
|
-
});
|
|
11126
|
-
validateFps(fps, "to spring()", false);
|
|
11127
|
-
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
11128
|
-
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring({
|
|
11129
|
-
fps,
|
|
11130
|
-
config,
|
|
11131
|
-
threshold: durationRestThreshold
|
|
11132
|
-
}) : undefined;
|
|
11133
|
-
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
11134
|
-
get: () => naturalDuration
|
|
11135
|
-
} : {
|
|
11136
|
-
get: () => {
|
|
11137
|
-
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
11138
|
-
}
|
|
11139
|
-
};
|
|
11140
|
-
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
11141
|
-
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
11142
|
-
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
11143
|
-
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
11144
|
-
return to;
|
|
11145
|
-
}
|
|
11146
|
-
const spr = springCalculation({
|
|
11147
|
-
fps,
|
|
11148
|
-
frame: durationProcessed,
|
|
11149
|
-
config
|
|
11150
|
-
});
|
|
11151
|
-
const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
|
|
11152
|
-
const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
|
|
11153
|
-
return interpolated;
|
|
11154
|
-
}
|
|
11155
11431
|
// src/static-file.ts
|
|
11156
11432
|
var problematicCharacters = {
|
|
11157
11433
|
"%3A": ":",
|
|
@@ -11242,27 +11518,27 @@ var staticFile = (path) => {
|
|
|
11242
11518
|
return preparsed;
|
|
11243
11519
|
};
|
|
11244
11520
|
// src/Still.tsx
|
|
11245
|
-
import
|
|
11521
|
+
import React42 from "react";
|
|
11246
11522
|
var Still = (props2) => {
|
|
11247
11523
|
const newProps = {
|
|
11248
11524
|
...props2,
|
|
11249
11525
|
durationInFrames: 1,
|
|
11250
11526
|
fps: 1
|
|
11251
11527
|
};
|
|
11252
|
-
return
|
|
11528
|
+
return React42.createElement(Composition, newProps);
|
|
11253
11529
|
};
|
|
11254
11530
|
// src/video/html5-video.tsx
|
|
11255
|
-
import { forwardRef as
|
|
11531
|
+
import { forwardRef as forwardRef16, useCallback as useCallback24, useContext as useContext39 } from "react";
|
|
11256
11532
|
|
|
11257
11533
|
// src/video/VideoForRendering.tsx
|
|
11258
11534
|
import {
|
|
11259
|
-
forwardRef as
|
|
11535
|
+
forwardRef as forwardRef15,
|
|
11260
11536
|
useContext as useContext38,
|
|
11261
11537
|
useEffect as useEffect21,
|
|
11262
11538
|
useImperativeHandle as useImperativeHandle10,
|
|
11263
11539
|
useLayoutEffect as useLayoutEffect12,
|
|
11264
11540
|
useMemo as useMemo39,
|
|
11265
|
-
useRef as
|
|
11541
|
+
useRef as useRef28
|
|
11266
11542
|
} from "react";
|
|
11267
11543
|
|
|
11268
11544
|
// src/video/seek-until-right.ts
|
|
@@ -11390,7 +11666,7 @@ var seekToTimeMultipleUntilRight = ({
|
|
|
11390
11666
|
};
|
|
11391
11667
|
|
|
11392
11668
|
// src/video/VideoForRendering.tsx
|
|
11393
|
-
import { jsx as
|
|
11669
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
11394
11670
|
var VideoForRenderingForwardFunction = ({
|
|
11395
11671
|
onError,
|
|
11396
11672
|
volume: volumeProp,
|
|
@@ -11412,7 +11688,7 @@ var VideoForRenderingForwardFunction = ({
|
|
|
11412
11688
|
const frame = useCurrentFrame();
|
|
11413
11689
|
const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
|
|
11414
11690
|
const videoConfig = useUnsafeVideoConfig();
|
|
11415
|
-
const videoRef =
|
|
11691
|
+
const videoRef = useRef28(null);
|
|
11416
11692
|
const sequenceContext = useContext38(SequenceContext);
|
|
11417
11693
|
const mediaStartsAt = useMediaStartsAt();
|
|
11418
11694
|
const environment = useRemotionEnvironment();
|
|
@@ -11603,16 +11879,16 @@ var VideoForRenderingForwardFunction = ({
|
|
|
11603
11879
|
delayRender2
|
|
11604
11880
|
]);
|
|
11605
11881
|
}
|
|
11606
|
-
return /* @__PURE__ */
|
|
11882
|
+
return /* @__PURE__ */ jsx38("video", {
|
|
11607
11883
|
ref: videoRef,
|
|
11608
11884
|
disableRemotePlayback: true,
|
|
11609
11885
|
...props2
|
|
11610
11886
|
});
|
|
11611
11887
|
};
|
|
11612
|
-
var VideoForRendering =
|
|
11888
|
+
var VideoForRendering = forwardRef15(VideoForRenderingForwardFunction);
|
|
11613
11889
|
|
|
11614
11890
|
// src/video/html5-video.tsx
|
|
11615
|
-
import { jsx as
|
|
11891
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
11616
11892
|
var VideoForwardingFunction = (props2, ref) => {
|
|
11617
11893
|
const {
|
|
11618
11894
|
startFrom,
|
|
@@ -11642,7 +11918,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11642
11918
|
throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
|
|
11643
11919
|
}
|
|
11644
11920
|
const preloadedSrc = usePreload(props2.src);
|
|
11645
|
-
const onDuration =
|
|
11921
|
+
const onDuration = useCallback24((src, durationInSeconds) => {
|
|
11646
11922
|
setDurations({ type: "got-duration", durationInSeconds, src });
|
|
11647
11923
|
}, [setDurations]);
|
|
11648
11924
|
const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props2.src)];
|
|
@@ -11655,7 +11931,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11655
11931
|
});
|
|
11656
11932
|
if (loop && durationFetched !== undefined) {
|
|
11657
11933
|
if (!Number.isFinite(durationFetched)) {
|
|
11658
|
-
return /* @__PURE__ */
|
|
11934
|
+
return /* @__PURE__ */ jsx39(Html5Video, {
|
|
11659
11935
|
...propsOtherThanLoop,
|
|
11660
11936
|
ref,
|
|
11661
11937
|
stack,
|
|
@@ -11663,7 +11939,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11663
11939
|
});
|
|
11664
11940
|
}
|
|
11665
11941
|
const mediaDuration = durationFetched * fps;
|
|
11666
|
-
return /* @__PURE__ */
|
|
11942
|
+
return /* @__PURE__ */ jsx39(Loop, {
|
|
11667
11943
|
durationInFrames: calculateMediaDuration({
|
|
11668
11944
|
trimAfter: trimAfterValue,
|
|
11669
11945
|
mediaDurationInFrames: mediaDuration,
|
|
@@ -11673,7 +11949,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11673
11949
|
layout: "none",
|
|
11674
11950
|
name,
|
|
11675
11951
|
showInTimeline: false,
|
|
11676
|
-
children: /* @__PURE__ */
|
|
11952
|
+
children: /* @__PURE__ */ jsx39(Html5Video, {
|
|
11677
11953
|
...propsOtherThanLoop,
|
|
11678
11954
|
ref,
|
|
11679
11955
|
stack,
|
|
@@ -11682,13 +11958,13 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11682
11958
|
});
|
|
11683
11959
|
}
|
|
11684
11960
|
if (typeof trimBeforeValue !== "undefined" || typeof trimAfterValue !== "undefined") {
|
|
11685
|
-
return /* @__PURE__ */
|
|
11961
|
+
return /* @__PURE__ */ jsx39(Sequence, {
|
|
11686
11962
|
layout: "none",
|
|
11687
11963
|
from: 0 - (trimBeforeValue ?? 0),
|
|
11688
11964
|
showInTimeline: false,
|
|
11689
11965
|
durationInFrames: trimAfterValue === undefined ? undefined : trimAfterValue / (props2.playbackRate ?? 1),
|
|
11690
11966
|
name,
|
|
11691
|
-
children: /* @__PURE__ */
|
|
11967
|
+
children: /* @__PURE__ */ jsx39(Html5Video, {
|
|
11692
11968
|
pauseWhenBuffering: pauseWhenBuffering ?? false,
|
|
11693
11969
|
onVideoFrame,
|
|
11694
11970
|
...otherProps,
|
|
@@ -11703,14 +11979,14 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11703
11979
|
volume: props2.volume
|
|
11704
11980
|
}, "Html5Video");
|
|
11705
11981
|
if (environment.isRendering) {
|
|
11706
|
-
return /* @__PURE__ */
|
|
11982
|
+
return /* @__PURE__ */ jsx39(VideoForRendering, {
|
|
11707
11983
|
onDuration,
|
|
11708
11984
|
onVideoFrame: onVideoFrame ?? null,
|
|
11709
11985
|
...otherProps,
|
|
11710
11986
|
ref
|
|
11711
11987
|
});
|
|
11712
11988
|
}
|
|
11713
|
-
return /* @__PURE__ */
|
|
11989
|
+
return /* @__PURE__ */ jsx39(VideoForPreview, {
|
|
11714
11990
|
onlyWarnForMediaSeekingError: false,
|
|
11715
11991
|
...otherProps,
|
|
11716
11992
|
ref,
|
|
@@ -11723,7 +11999,7 @@ var VideoForwardingFunction = (props2, ref) => {
|
|
|
11723
11999
|
onAutoPlayError: onAutoPlayError ?? undefined
|
|
11724
12000
|
});
|
|
11725
12001
|
};
|
|
11726
|
-
var Html5Video =
|
|
12002
|
+
var Html5Video = forwardRef16(VideoForwardingFunction);
|
|
11727
12003
|
addSequenceStackTraces(Html5Video);
|
|
11728
12004
|
var Video = Html5Video;
|
|
11729
12005
|
// src/index.ts
|
|
@@ -11793,6 +12069,7 @@ export {
|
|
|
11793
12069
|
MediaPlaybackError,
|
|
11794
12070
|
Loop,
|
|
11795
12071
|
Internals,
|
|
12072
|
+
Interactive,
|
|
11796
12073
|
Img,
|
|
11797
12074
|
IFrame,
|
|
11798
12075
|
HtmlInCanvas,
|