@remotion/vercel 4.0.541 → 4.0.543
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.mjs +2233 -2232
- package/dist/render-media-on-vercel.d.ts +1 -0
- package/package.json +6 -6
package/dist/esm/index.mjs
CHANGED
|
@@ -114,218 +114,105 @@ var script = `// src/scripts/render-still.ts
|
|
|
114
114
|
import { statSync } from "fs";
|
|
115
115
|
import { RenderInternals } from "@remotion/renderer";
|
|
116
116
|
|
|
117
|
-
// ../core/dist/esm/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
// ../core/dist/esm/chunk-m38ydj0s.mjs
|
|
118
|
+
function truthy(value) {
|
|
119
|
+
return Boolean(value);
|
|
120
|
+
}
|
|
121
|
+
var DATE_TOKEN = "remotion-date:";
|
|
122
|
+
var FILE_TOKEN = "remotion-file:";
|
|
123
|
+
var serializeJSONWithSpecialTypes = ({
|
|
124
|
+
data,
|
|
125
|
+
indent,
|
|
126
|
+
staticBase
|
|
127
|
+
}) => {
|
|
128
|
+
let customDateUsed = false;
|
|
129
|
+
let customFileUsed = false;
|
|
130
|
+
let mapUsed = false;
|
|
131
|
+
let setUsed = false;
|
|
132
|
+
try {
|
|
133
|
+
const serializedString = JSON.stringify(data, function(key, value) {
|
|
134
|
+
const item = this[key];
|
|
135
|
+
if (item instanceof Date) {
|
|
136
|
+
customDateUsed = true;
|
|
137
|
+
return \`\${DATE_TOKEN}\${item.toISOString()}\`;
|
|
138
|
+
}
|
|
139
|
+
if (item instanceof Map) {
|
|
140
|
+
mapUsed = true;
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
if (item instanceof Set) {
|
|
144
|
+
setUsed = true;
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
if (typeof item === "string" && staticBase !== null && staticBase !== "" && item.startsWith(staticBase)) {
|
|
148
|
+
customFileUsed = true;
|
|
149
|
+
return \`\${FILE_TOKEN}\${item.replace(staticBase + "/", "")}\`;
|
|
150
|
+
}
|
|
151
|
+
return value;
|
|
152
|
+
}, indent);
|
|
153
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
154
|
+
} catch (err) {
|
|
155
|
+
throw new Error("Could not serialize the passed input props to JSON: " + err.message);
|
|
121
156
|
}
|
|
122
|
-
return value;
|
|
123
157
|
};
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
const right = evaluateSourceNumericValue(expression.right, config);
|
|
134
|
-
switch (expression.operator) {
|
|
135
|
-
case "+":
|
|
136
|
-
return left + right;
|
|
137
|
-
case "-":
|
|
138
|
-
return left - right;
|
|
139
|
-
case "*":
|
|
140
|
-
return left * right;
|
|
141
|
-
case "/":
|
|
142
|
-
return left / right;
|
|
143
|
-
default:
|
|
144
|
-
throw new Error("Unknown source expression operator");
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const value = expression.binding.type === "constant" ? expression.binding.value : config?.[expression.binding.field] ?? NaN;
|
|
148
|
-
if (expression.type === "video-config-multiplication") {
|
|
149
|
-
return value * expression.multiplier;
|
|
150
|
-
}
|
|
151
|
-
if (expression.type === "video-config-subtraction") {
|
|
152
|
-
return value - expression.subtrahend;
|
|
158
|
+
var resolveFileTokenToUrl = (value) => {
|
|
159
|
+
const encodedName = value.replace(FILE_TOKEN, "");
|
|
160
|
+
let name = encodedName;
|
|
161
|
+
try {
|
|
162
|
+
name = encodedName.split("/").map(decodeURIComponent).join("/");
|
|
163
|
+
} catch {}
|
|
164
|
+
const matchingStaticFile = window.remotion_staticFiles?.find((file) => file.name === name);
|
|
165
|
+
if (matchingStaticFile) {
|
|
166
|
+
return matchingStaticFile.src;
|
|
153
167
|
}
|
|
154
|
-
return
|
|
168
|
+
return \`\${window.remotion_staticBase}/\${encodedName}\`;
|
|
155
169
|
};
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const existing = cached.get(configKey);
|
|
161
|
-
if (existing)
|
|
162
|
-
return existing;
|
|
163
|
-
const result = Object.fromEntries(Object.entries(props).map(([key, status]) => {
|
|
164
|
-
if (status.status === "computed") {
|
|
165
|
-
return [key, status];
|
|
166
|
-
}
|
|
167
|
-
const adjustment = status.keyframeDisplayOffsetAdjustment === null ? null : evaluateSourceNumericValue(status.keyframeDisplayOffsetAdjustment, config);
|
|
168
|
-
const rate = evaluateSourceNumericValue(status.keyframePlaybackRateAdjustment ?? 1, config);
|
|
169
|
-
if (adjustment !== null && !Number.isFinite(adjustment) || !Number.isFinite(rate) || rate <= 0) {
|
|
170
|
-
return [key, { status: "computed" }];
|
|
171
|
-
}
|
|
172
|
-
const timing = {
|
|
173
|
-
keyframeDisplayOffsetAdjustment: adjustment,
|
|
174
|
-
...status.keyframePlaybackRateAdjustment === undefined ? {} : { keyframePlaybackRateAdjustment: rate }
|
|
175
|
-
};
|
|
176
|
-
if (status.status === "static") {
|
|
177
|
-
const value = status.numericExpression === undefined ? status.codeValue : evaluateSourceNumericValue(status.numericExpression, config);
|
|
178
|
-
return [
|
|
179
|
-
key,
|
|
180
|
-
status.numericExpression !== undefined && !Number.isFinite(value) ? { status: "computed" } : { ...status, ...timing, codeValue: value }
|
|
181
|
-
];
|
|
170
|
+
var deserializeJSONWithSpecialTypes = (data) => {
|
|
171
|
+
return JSON.parse(data, (_, value) => {
|
|
172
|
+
if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
|
|
173
|
+
return new Date(value.replace(DATE_TOKEN, ""));
|
|
182
174
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
frame: evaluateSourceNumericValue(keyframe.frame, config)
|
|
186
|
-
}));
|
|
187
|
-
if (keyframes.some((keyframe, index) => !Number.isFinite(keyframe.frame) || index > 0 && keyframe.frame <= keyframes[index - 1].frame)) {
|
|
188
|
-
return [key, { status: "computed" }];
|
|
175
|
+
if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
|
|
176
|
+
return resolveFileTokenToUrl(value);
|
|
189
177
|
}
|
|
190
|
-
return
|
|
191
|
-
})
|
|
192
|
-
cached.set(configKey, result);
|
|
193
|
-
if (cached.size > 8)
|
|
194
|
-
cached.delete(cached.keys().next().value);
|
|
195
|
-
evaluatedProps.set(props, cached);
|
|
196
|
-
return result;
|
|
178
|
+
return value;
|
|
179
|
+
});
|
|
197
180
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var SUBDIVISION_PRECISION = 0.0000001;
|
|
202
|
-
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
203
|
-
var kSplineTableSize = 11;
|
|
204
|
-
var kSampleStepSize = 1 / (kSplineTableSize - 1);
|
|
205
|
-
var float32ArraySupported = typeof Float32Array === "function";
|
|
206
|
-
function a(aA1, aA2) {
|
|
207
|
-
return 1 - 3 * aA2 + 3 * aA1;
|
|
208
|
-
}
|
|
209
|
-
function b(aA1, aA2) {
|
|
210
|
-
return 3 * aA2 - 6 * aA1;
|
|
211
|
-
}
|
|
212
|
-
function c(aA1) {
|
|
213
|
-
return 3 * aA1;
|
|
214
|
-
}
|
|
215
|
-
function calcBezier(aT, aA1, aA2) {
|
|
216
|
-
return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
|
|
217
|
-
}
|
|
218
|
-
function getSlope(aT, aA1, aA2) {
|
|
219
|
-
return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
|
|
220
|
-
}
|
|
221
|
-
function binarySubdivide({
|
|
222
|
-
aX,
|
|
223
|
-
_aA,
|
|
224
|
-
_aB,
|
|
225
|
-
mX1,
|
|
226
|
-
mX2
|
|
227
|
-
}) {
|
|
228
|
-
let currentX;
|
|
229
|
-
let currentT;
|
|
230
|
-
let i = 0;
|
|
231
|
-
let aA = _aA;
|
|
232
|
-
let aB = _aB;
|
|
233
|
-
do {
|
|
234
|
-
currentT = aA + (aB - aA) / 2;
|
|
235
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
236
|
-
if (currentX > 0) {
|
|
237
|
-
aB = currentT;
|
|
238
|
-
} else {
|
|
239
|
-
aA = currentT;
|
|
240
|
-
}
|
|
241
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
242
|
-
return currentT;
|
|
243
|
-
}
|
|
244
|
-
function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) {
|
|
245
|
-
let aGuessT = _aGuessT;
|
|
246
|
-
for (let i = 0;i < NEWTON_ITERATIONS; ++i) {
|
|
247
|
-
const currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
248
|
-
if (currentSlope === 0) {
|
|
249
|
-
return aGuessT;
|
|
250
|
-
}
|
|
251
|
-
const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
252
|
-
aGuessT -= currentX / currentSlope;
|
|
181
|
+
function validateDimension(amount, nameOfProp, location) {
|
|
182
|
+
if (typeof amount !== "number") {
|
|
183
|
+
throw new Error(\`The "\${nameOfProp}" prop \${location} must be a number, but you passed a value of type \${typeof amount}\`);
|
|
253
184
|
}
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
function bezier(mX1, mY1, mX2, mY2) {
|
|
257
|
-
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
|
258
|
-
throw new Error("bezier x values must be in [0, 1] range");
|
|
185
|
+
if (isNaN(amount)) {
|
|
186
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must not be NaN, but is NaN.\`);
|
|
259
187
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
for (let i = 0;i < kSplineTableSize; ++i) {
|
|
263
|
-
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
264
|
-
}
|
|
188
|
+
if (!Number.isFinite(amount)) {
|
|
189
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
265
190
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
intervalStart += kSampleStepSize;
|
|
272
|
-
}
|
|
273
|
-
--currentSample;
|
|
274
|
-
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
275
|
-
const guessForT = intervalStart + dist * kSampleStepSize;
|
|
276
|
-
const initialSlope = getSlope(guessForT, mX1, mX2);
|
|
277
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
278
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
279
|
-
}
|
|
280
|
-
if (initialSlope === 0) {
|
|
281
|
-
return guessForT;
|
|
282
|
-
}
|
|
283
|
-
return binarySubdivide({
|
|
284
|
-
aX,
|
|
285
|
-
_aA: intervalStart,
|
|
286
|
-
_aB: intervalStart + kSampleStepSize,
|
|
287
|
-
mX1,
|
|
288
|
-
mX2
|
|
289
|
-
});
|
|
191
|
+
if (amount % 1 !== 0) {
|
|
192
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
193
|
+
}
|
|
194
|
+
if (amount <= 0) {
|
|
195
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be positive, but got \${amount}.\`);
|
|
290
196
|
}
|
|
291
|
-
return function(x) {
|
|
292
|
-
const clampedX = Math.min(1, Math.max(0, x));
|
|
293
|
-
if (mX1 === mY1 && mX2 === mY2) {
|
|
294
|
-
return clampedX;
|
|
295
|
-
}
|
|
296
|
-
if (clampedX === 0) {
|
|
297
|
-
return 0;
|
|
298
|
-
}
|
|
299
|
-
if (clampedX === 1) {
|
|
300
|
-
return 1;
|
|
301
|
-
}
|
|
302
|
-
return calcBezier(getTForX(clampedX), mY1, mY2);
|
|
303
|
-
};
|
|
304
197
|
}
|
|
305
|
-
|
|
306
|
-
allowFloats,
|
|
307
|
-
durationInFrames
|
|
308
|
-
|
|
309
|
-
}) => {
|
|
310
|
-
if (typeof frame === "undefined") {
|
|
311
|
-
throw new TypeError(\`Argument missing for parameter "frame"\`);
|
|
198
|
+
function validateDurationInFrames(durationInFrames, options) {
|
|
199
|
+
const { allowFloats, component } = options;
|
|
200
|
+
if (typeof durationInFrames === "undefined") {
|
|
201
|
+
throw new Error(\`The "durationInFrames" prop \${component} is missing.\`);
|
|
312
202
|
}
|
|
313
|
-
if (typeof
|
|
314
|
-
throw new
|
|
315
|
-
}
|
|
316
|
-
if (!Number.isFinite(frame)) {
|
|
317
|
-
throw new RangeError(\`Frame \${frame} is not finite\`);
|
|
203
|
+
if (typeof durationInFrames !== "number") {
|
|
204
|
+
throw new Error(\`The "durationInFrames" prop \${component} must be a number, but you passed a value of type \${typeof durationInFrames}\`);
|
|
318
205
|
}
|
|
319
|
-
if (
|
|
320
|
-
throw new
|
|
206
|
+
if (durationInFrames <= 0) {
|
|
207
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be positive, but got \${durationInFrames}.\`);
|
|
321
208
|
}
|
|
322
|
-
if (
|
|
323
|
-
throw new
|
|
209
|
+
if (!Number.isFinite(durationInFrames)) {
|
|
210
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be finite, but got \${durationInFrames}.\`);
|
|
324
211
|
}
|
|
325
|
-
if (
|
|
326
|
-
throw new
|
|
212
|
+
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
213
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be an integer, but got \${durationInFrames}.\`);
|
|
327
214
|
}
|
|
328
|
-
}
|
|
215
|
+
}
|
|
329
216
|
function validateFps(fps, location, isGif) {
|
|
330
217
|
if (typeof fps !== "number") {
|
|
331
218
|
throw new Error(\`"fps" must be a number, but you passed a value of type \${typeof fps} \${location}\`);
|
|
@@ -343,362 +230,539 @@ function validateFps(fps, location, isGif) {
|
|
|
343
230
|
throw new TypeError(\`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif\`);
|
|
344
231
|
}
|
|
345
232
|
}
|
|
346
|
-
var
|
|
347
|
-
|
|
233
|
+
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
234
|
+
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
235
|
+
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
236
|
+
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
237
|
+
var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
238
|
+
if (!defaultProps) {
|
|
348
239
|
return;
|
|
349
240
|
}
|
|
350
|
-
if (typeof
|
|
351
|
-
throw new
|
|
241
|
+
if (typeof defaultProps !== "object") {
|
|
242
|
+
throw new Error(\`"\${name}" must be an object, but you passed a value of type \${typeof defaultProps}\`);
|
|
352
243
|
}
|
|
353
|
-
if (
|
|
354
|
-
throw new
|
|
244
|
+
if (Array.isArray(defaultProps)) {
|
|
245
|
+
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
355
246
|
}
|
|
356
|
-
|
|
357
|
-
|
|
247
|
+
};
|
|
248
|
+
var ENABLE_V5_BREAKING_CHANGES = false;
|
|
249
|
+
var DEFAULT_PREMOUNT_IN_SECONDS = ENABLE_V5_BREAKING_CHANGES ? 2 : 0;
|
|
250
|
+
var DEFAULT_STUDIO_PREMOUNT_IN_SECONDS = 2;
|
|
251
|
+
var validateDefaultPremountInSeconds = (value) => {
|
|
252
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
253
|
+
throw new TypeError(\`defaultPremountInSeconds must be a finite, non-negative number, but got \${String(value)}.\`);
|
|
358
254
|
}
|
|
359
|
-
|
|
360
|
-
|
|
255
|
+
};
|
|
256
|
+
var DEFAULT_SEQUENCE_ACTIVITY_LIMIT = Infinity;
|
|
257
|
+
var transformSchema = {
|
|
258
|
+
"style.transformOrigin": {
|
|
259
|
+
type: "transform-origin",
|
|
260
|
+
step: 1,
|
|
261
|
+
default: "50% 50%",
|
|
262
|
+
description: "Origin"
|
|
263
|
+
},
|
|
264
|
+
"style.translate": {
|
|
265
|
+
type: "translate",
|
|
266
|
+
step: 1,
|
|
267
|
+
default: "0px 0px",
|
|
268
|
+
description: "Offset"
|
|
269
|
+
},
|
|
270
|
+
"style.scale": {
|
|
271
|
+
type: "scale",
|
|
272
|
+
max: 100,
|
|
273
|
+
step: 0.01,
|
|
274
|
+
default: 1,
|
|
275
|
+
description: "Scale",
|
|
276
|
+
defaultKeyframeOutput: "perceptual-scale"
|
|
277
|
+
},
|
|
278
|
+
"style.rotate": {
|
|
279
|
+
type: "rotation-css",
|
|
280
|
+
step: 1,
|
|
281
|
+
default: "0deg",
|
|
282
|
+
description: "Rotation"
|
|
283
|
+
},
|
|
284
|
+
"style.opacity": {
|
|
285
|
+
type: "number",
|
|
286
|
+
min: 0,
|
|
287
|
+
max: 1,
|
|
288
|
+
step: 0.01,
|
|
289
|
+
default: 1,
|
|
290
|
+
description: "Opacity",
|
|
291
|
+
hiddenFromList: false
|
|
361
292
|
}
|
|
362
293
|
};
|
|
363
|
-
var
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
294
|
+
var borderSchema = {
|
|
295
|
+
"style.borderWidth": {
|
|
296
|
+
type: "number",
|
|
297
|
+
default: undefined,
|
|
298
|
+
min: 0,
|
|
299
|
+
step: 1,
|
|
300
|
+
description: "Border width",
|
|
301
|
+
hiddenFromList: false
|
|
302
|
+
},
|
|
303
|
+
"style.borderStyle": {
|
|
304
|
+
type: "enum",
|
|
305
|
+
default: "none",
|
|
306
|
+
description: "Border style",
|
|
307
|
+
variants: {
|
|
308
|
+
none: {},
|
|
309
|
+
hidden: {},
|
|
310
|
+
solid: {},
|
|
311
|
+
dashed: {},
|
|
312
|
+
dotted: {},
|
|
313
|
+
double: {},
|
|
314
|
+
groove: {},
|
|
315
|
+
ridge: {},
|
|
316
|
+
inset: {},
|
|
317
|
+
outset: {}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"style.borderColor": {
|
|
321
|
+
type: "color",
|
|
322
|
+
default: undefined,
|
|
323
|
+
description: "Border color"
|
|
324
|
+
}
|
|
368
325
|
};
|
|
369
|
-
var
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
326
|
+
var borderRadiusSchema = {
|
|
327
|
+
"style.borderRadius": {
|
|
328
|
+
type: "number",
|
|
329
|
+
default: 0,
|
|
330
|
+
min: 0,
|
|
331
|
+
step: 1,
|
|
332
|
+
description: "Border radius",
|
|
333
|
+
hiddenFromList: false,
|
|
334
|
+
keyframable: true
|
|
335
|
+
},
|
|
336
|
+
"style.borderTopLeftRadius": {
|
|
337
|
+
type: "number",
|
|
338
|
+
default: 0,
|
|
339
|
+
min: 0,
|
|
340
|
+
step: 1,
|
|
341
|
+
description: "Top left radius",
|
|
342
|
+
hiddenFromList: false
|
|
343
|
+
},
|
|
344
|
+
"style.borderTopRightRadius": {
|
|
345
|
+
type: "number",
|
|
346
|
+
default: 0,
|
|
347
|
+
min: 0,
|
|
348
|
+
step: 1,
|
|
349
|
+
description: "Top right radius",
|
|
350
|
+
hiddenFromList: false
|
|
351
|
+
},
|
|
352
|
+
"style.borderBottomRightRadius": {
|
|
353
|
+
type: "number",
|
|
354
|
+
default: 0,
|
|
355
|
+
min: 0,
|
|
356
|
+
step: 1,
|
|
357
|
+
description: "Bottom right radius",
|
|
358
|
+
hiddenFromList: false
|
|
359
|
+
},
|
|
360
|
+
"style.borderBottomLeftRadius": {
|
|
361
|
+
type: "number",
|
|
362
|
+
default: 0,
|
|
363
|
+
min: 0,
|
|
364
|
+
step: 1,
|
|
365
|
+
description: "Bottom left radius",
|
|
366
|
+
hiddenFromList: false
|
|
379
367
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
current,
|
|
387
|
-
velocity,
|
|
388
|
-
c,
|
|
389
|
-
m,
|
|
390
|
-
k,
|
|
391
|
-
now
|
|
392
|
-
].join("-");
|
|
393
|
-
if (advanceCache[cacheKey]) {
|
|
394
|
-
return advanceCache[cacheKey];
|
|
368
|
+
};
|
|
369
|
+
var backgroundSchema = {
|
|
370
|
+
"style.backgroundColor": {
|
|
371
|
+
type: "color",
|
|
372
|
+
default: "transparent",
|
|
373
|
+
description: "Color"
|
|
395
374
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
const sin1 = Math.sin(omega1 * t);
|
|
403
|
-
const cos1 = Math.cos(omega1 * t);
|
|
404
|
-
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
405
|
-
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
406
|
-
const underDampedPosition = toValue - underDampedFrag1;
|
|
407
|
-
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
408
|
-
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
409
|
-
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
410
|
-
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
411
|
-
const animationNode = {
|
|
412
|
-
toValue,
|
|
413
|
-
prevPosition: current,
|
|
414
|
-
lastTimestamp: now,
|
|
415
|
-
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
416
|
-
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
417
|
-
};
|
|
418
|
-
advanceCache[cacheKey] = animationNode;
|
|
419
|
-
return animationNode;
|
|
420
|
-
}
|
|
421
|
-
var calculationCache = {};
|
|
422
|
-
function springCalculation({
|
|
423
|
-
frame,
|
|
424
|
-
fps,
|
|
425
|
-
config = {}
|
|
426
|
-
}) {
|
|
427
|
-
const from = 0;
|
|
428
|
-
const to = 1;
|
|
429
|
-
const resolvedConfig = {
|
|
430
|
-
damping: config.damping ?? defaultSpringConfig.damping,
|
|
431
|
-
mass: config.mass ?? defaultSpringConfig.mass,
|
|
432
|
-
stiffness: config.stiffness ?? defaultSpringConfig.stiffness,
|
|
433
|
-
overshootClamping: config.overshootClamping ?? defaultSpringConfig.overshootClamping
|
|
434
|
-
};
|
|
435
|
-
const configKey = [
|
|
436
|
-
fps,
|
|
437
|
-
resolvedConfig.damping,
|
|
438
|
-
resolvedConfig.mass,
|
|
439
|
-
resolvedConfig.overshootClamping,
|
|
440
|
-
resolvedConfig.stiffness
|
|
441
|
-
].join("-");
|
|
442
|
-
const cacheKey = \`\${frame}-\${configKey}\`;
|
|
443
|
-
if (calculationCache[cacheKey]) {
|
|
444
|
-
return calculationCache[cacheKey];
|
|
375
|
+
};
|
|
376
|
+
var svgColorSchema = {
|
|
377
|
+
color: {
|
|
378
|
+
type: "color",
|
|
379
|
+
default: undefined,
|
|
380
|
+
description: "Current color"
|
|
445
381
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
animation,
|
|
462
|
-
now: time,
|
|
463
|
-
config: resolvedConfig
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
if (unevenRest > 0) {
|
|
467
|
-
animation = advance({
|
|
468
|
-
animation,
|
|
469
|
-
now: frameClamped / fps * 1000,
|
|
470
|
-
config: resolvedConfig
|
|
471
|
-
});
|
|
382
|
+
};
|
|
383
|
+
var svgStrokeSchema = {
|
|
384
|
+
...svgColorSchema,
|
|
385
|
+
stroke: {
|
|
386
|
+
type: "color",
|
|
387
|
+
default: "none",
|
|
388
|
+
description: "Stroke"
|
|
389
|
+
},
|
|
390
|
+
strokeWidth: {
|
|
391
|
+
type: "number",
|
|
392
|
+
default: 1,
|
|
393
|
+
description: "Stroke width",
|
|
394
|
+
min: 0,
|
|
395
|
+
step: 1,
|
|
396
|
+
hiddenFromList: false
|
|
472
397
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
398
|
+
};
|
|
399
|
+
var svgPaintSchema = {
|
|
400
|
+
fill: {
|
|
401
|
+
type: "color",
|
|
402
|
+
default: undefined,
|
|
403
|
+
description: "Fill"
|
|
404
|
+
},
|
|
405
|
+
...svgStrokeSchema
|
|
406
|
+
};
|
|
407
|
+
var premountSchema = {
|
|
408
|
+
premountFor: {
|
|
409
|
+
type: "number",
|
|
410
|
+
default: undefined,
|
|
411
|
+
description: "Premount For",
|
|
412
|
+
min: 0,
|
|
413
|
+
step: 1,
|
|
414
|
+
hiddenFromList: false,
|
|
415
|
+
keyframable: false
|
|
416
|
+
},
|
|
417
|
+
postmountFor: {
|
|
418
|
+
type: "number",
|
|
419
|
+
default: 0,
|
|
420
|
+
min: 0,
|
|
421
|
+
step: 1,
|
|
422
|
+
hiddenFromList: true,
|
|
423
|
+
keyframable: false
|
|
484
424
|
}
|
|
485
|
-
|
|
486
|
-
|
|
425
|
+
};
|
|
426
|
+
var sequencePremountSchema = {
|
|
427
|
+
...premountSchema
|
|
428
|
+
};
|
|
429
|
+
var cropSchema = {
|
|
430
|
+
cropLeft: {
|
|
431
|
+
type: "number",
|
|
432
|
+
default: 0,
|
|
433
|
+
description: "Crop left",
|
|
434
|
+
min: 0,
|
|
435
|
+
max: 1,
|
|
436
|
+
step: 0.01,
|
|
437
|
+
hiddenFromList: false,
|
|
438
|
+
keyframable: true
|
|
439
|
+
},
|
|
440
|
+
cropRight: {
|
|
441
|
+
type: "number",
|
|
442
|
+
default: 0,
|
|
443
|
+
description: "Crop right",
|
|
444
|
+
min: 0,
|
|
445
|
+
max: 1,
|
|
446
|
+
step: 0.01,
|
|
447
|
+
hiddenFromList: false,
|
|
448
|
+
keyframable: true
|
|
449
|
+
},
|
|
450
|
+
cropTop: {
|
|
451
|
+
type: "number",
|
|
452
|
+
default: 0,
|
|
453
|
+
description: "Crop top",
|
|
454
|
+
min: 0,
|
|
455
|
+
max: 1,
|
|
456
|
+
step: 0.01,
|
|
457
|
+
hiddenFromList: false,
|
|
458
|
+
keyframable: true
|
|
459
|
+
},
|
|
460
|
+
cropBottom: {
|
|
461
|
+
type: "number",
|
|
462
|
+
default: 0,
|
|
463
|
+
description: "Crop bottom",
|
|
464
|
+
min: 0,
|
|
465
|
+
max: 1,
|
|
466
|
+
step: 0.01,
|
|
467
|
+
hiddenFromList: false,
|
|
468
|
+
keyframable: true
|
|
487
469
|
}
|
|
488
|
-
|
|
489
|
-
|
|
470
|
+
};
|
|
471
|
+
var sequenceCropSchema = cropSchema;
|
|
472
|
+
var sequenceStyleSchema = {
|
|
473
|
+
...sequenceCropSchema,
|
|
474
|
+
...transformSchema,
|
|
475
|
+
...backgroundSchema,
|
|
476
|
+
...borderSchema,
|
|
477
|
+
...borderRadiusSchema
|
|
478
|
+
};
|
|
479
|
+
var hiddenField = {
|
|
480
|
+
type: "boolean",
|
|
481
|
+
default: false,
|
|
482
|
+
description: "Hidden"
|
|
483
|
+
};
|
|
484
|
+
var showInTimelineField = {
|
|
485
|
+
type: "hidden"
|
|
486
|
+
};
|
|
487
|
+
var sequenceNameField = {
|
|
488
|
+
type: "hidden"
|
|
489
|
+
};
|
|
490
|
+
var durationInFramesField = {
|
|
491
|
+
type: "number",
|
|
492
|
+
default: undefined,
|
|
493
|
+
min: 1,
|
|
494
|
+
step: 1,
|
|
495
|
+
hiddenFromList: true
|
|
496
|
+
};
|
|
497
|
+
var fromField = {
|
|
498
|
+
type: "number",
|
|
499
|
+
default: 0,
|
|
500
|
+
step: 1,
|
|
501
|
+
hiddenFromList: true
|
|
502
|
+
};
|
|
503
|
+
var trimBeforeField = {
|
|
504
|
+
type: "number",
|
|
505
|
+
default: 0,
|
|
506
|
+
min: 0,
|
|
507
|
+
step: 1,
|
|
508
|
+
hiddenFromList: true
|
|
509
|
+
};
|
|
510
|
+
var sequenceTimingSchema = {
|
|
511
|
+
from: {
|
|
512
|
+
...fromField,
|
|
513
|
+
description: "From",
|
|
514
|
+
hiddenFromList: false,
|
|
515
|
+
keyframable: false
|
|
516
|
+
},
|
|
517
|
+
durationInFrames: {
|
|
518
|
+
...durationInFramesField,
|
|
519
|
+
description: "Duration",
|
|
520
|
+
hiddenFromList: false,
|
|
521
|
+
keyframable: false
|
|
522
|
+
},
|
|
523
|
+
trimBefore: {
|
|
524
|
+
...trimBeforeField,
|
|
525
|
+
description: "Trim before",
|
|
526
|
+
hiddenFromList: false,
|
|
527
|
+
keyframable: false
|
|
490
528
|
}
|
|
491
|
-
|
|
492
|
-
|
|
529
|
+
};
|
|
530
|
+
var freezeField = {
|
|
531
|
+
type: "number",
|
|
532
|
+
default: null,
|
|
533
|
+
step: 1,
|
|
534
|
+
hiddenFromList: true
|
|
535
|
+
};
|
|
536
|
+
var playbackRateField = {
|
|
537
|
+
type: "number",
|
|
538
|
+
default: 1,
|
|
539
|
+
min: 0.01,
|
|
540
|
+
step: 0.1,
|
|
541
|
+
description: "Playback rate",
|
|
542
|
+
hiddenFromList: false,
|
|
543
|
+
keyframable: false
|
|
544
|
+
};
|
|
545
|
+
var baseSchema = {
|
|
546
|
+
durationInFrames: durationInFramesField,
|
|
547
|
+
from: fromField,
|
|
548
|
+
trimBefore: trimBeforeField,
|
|
549
|
+
playbackRate: playbackRateField,
|
|
550
|
+
freeze: freezeField,
|
|
551
|
+
hidden: hiddenField,
|
|
552
|
+
name: sequenceNameField,
|
|
553
|
+
showInTimeline: showInTimelineField
|
|
554
|
+
};
|
|
555
|
+
var sequenceSchema = {
|
|
556
|
+
...baseSchema,
|
|
557
|
+
layout: {
|
|
558
|
+
type: "enum",
|
|
559
|
+
default: "absolute-fill",
|
|
560
|
+
description: "Layout",
|
|
561
|
+
variants: {
|
|
562
|
+
"absolute-fill": sequenceStyleSchema,
|
|
563
|
+
none: {}
|
|
564
|
+
}
|
|
493
565
|
}
|
|
494
|
-
|
|
495
|
-
|
|
566
|
+
};
|
|
567
|
+
var baseSchemaWithoutFrom = {
|
|
568
|
+
durationInFrames: durationInFramesField,
|
|
569
|
+
trimBefore: trimBeforeField,
|
|
570
|
+
playbackRate: playbackRateField,
|
|
571
|
+
freeze: freezeField,
|
|
572
|
+
hidden: hiddenField,
|
|
573
|
+
name: sequenceNameField,
|
|
574
|
+
showInTimeline: showInTimelineField
|
|
575
|
+
};
|
|
576
|
+
var sequenceSchemaWithoutFrom = {
|
|
577
|
+
...baseSchemaWithoutFrom,
|
|
578
|
+
layout: sequenceSchema.layout
|
|
579
|
+
};
|
|
580
|
+
var sequenceSchemaDefaultLayoutNone = {
|
|
581
|
+
...sequenceSchema,
|
|
582
|
+
layout: {
|
|
583
|
+
...sequenceSchema.layout,
|
|
584
|
+
default: "none"
|
|
496
585
|
}
|
|
497
|
-
|
|
498
|
-
|
|
586
|
+
};
|
|
587
|
+
var evaluateSourceNumericValue = (expression, config) => {
|
|
588
|
+
if (typeof expression === "number") {
|
|
589
|
+
return expression;
|
|
499
590
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
config.damping,
|
|
503
|
-
config.mass,
|
|
504
|
-
config.overshootClamping,
|
|
505
|
-
config.stiffness,
|
|
506
|
-
threshold
|
|
507
|
-
].join("-");
|
|
508
|
-
if (cache.has(cacheKey)) {
|
|
509
|
-
return cache.get(cacheKey);
|
|
591
|
+
if (expression.type === "literal") {
|
|
592
|
+
return expression.value;
|
|
510
593
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
let difference = calcDifference();
|
|
526
|
-
while (difference >= threshold) {
|
|
527
|
-
frame++;
|
|
528
|
-
animation = calc();
|
|
529
|
-
difference = calcDifference();
|
|
530
|
-
}
|
|
531
|
-
finishedFrame = frame;
|
|
532
|
-
for (let i = 0;i < 20; i++) {
|
|
533
|
-
frame++;
|
|
534
|
-
animation = calc();
|
|
535
|
-
difference = calcDifference();
|
|
536
|
-
if (difference >= threshold) {
|
|
537
|
-
i = 0;
|
|
538
|
-
finishedFrame = frame + 1;
|
|
594
|
+
if (expression.type === "binary") {
|
|
595
|
+
const left = evaluateSourceNumericValue(expression.left, config);
|
|
596
|
+
const right = evaluateSourceNumericValue(expression.right, config);
|
|
597
|
+
switch (expression.operator) {
|
|
598
|
+
case "+":
|
|
599
|
+
return left + right;
|
|
600
|
+
case "-":
|
|
601
|
+
return left - right;
|
|
602
|
+
case "*":
|
|
603
|
+
return left * right;
|
|
604
|
+
case "/":
|
|
605
|
+
return left / right;
|
|
606
|
+
default:
|
|
607
|
+
throw new Error("Unknown source expression operator");
|
|
539
608
|
}
|
|
540
609
|
}
|
|
541
|
-
|
|
542
|
-
|
|
610
|
+
const value = expression.binding.type === "constant" ? expression.binding.value : config?.[expression.binding.field] ?? NaN;
|
|
611
|
+
if (expression.type === "video-config-multiplication") {
|
|
612
|
+
return value * expression.multiplier;
|
|
613
|
+
}
|
|
614
|
+
if (expression.type === "video-config-subtraction") {
|
|
615
|
+
return value - expression.subtrahend;
|
|
616
|
+
}
|
|
617
|
+
return value;
|
|
618
|
+
};
|
|
619
|
+
var evaluatedProps = new WeakMap;
|
|
620
|
+
var evaluateSourcePropStatuses = (props, config) => {
|
|
621
|
+
const configKey = config === null ? "" : \`\${config.durationInFrames}:\${config.fps}:\${config.width}:\${config.height}\`;
|
|
622
|
+
const cached = evaluatedProps.get(props) ?? new Map;
|
|
623
|
+
const existing = cached.get(configKey);
|
|
624
|
+
if (existing)
|
|
625
|
+
return existing;
|
|
626
|
+
const result = Object.fromEntries(Object.entries(props).map(([key, status]) => {
|
|
627
|
+
if (status.status === "computed") {
|
|
628
|
+
return [key, status];
|
|
629
|
+
}
|
|
630
|
+
const adjustment = status.keyframeDisplayOffsetAdjustment === null ? null : evaluateSourceNumericValue(status.keyframeDisplayOffsetAdjustment, config);
|
|
631
|
+
const rate = evaluateSourceNumericValue(status.keyframePlaybackRateAdjustment ?? 1, config);
|
|
632
|
+
if (adjustment !== null && !Number.isFinite(adjustment) || !Number.isFinite(rate) || rate <= 0) {
|
|
633
|
+
return [key, { status: "computed" }];
|
|
634
|
+
}
|
|
635
|
+
const timing = {
|
|
636
|
+
keyframeDisplayOffsetAdjustment: adjustment,
|
|
637
|
+
...status.keyframePlaybackRateAdjustment === undefined ? {} : { keyframePlaybackRateAdjustment: rate }
|
|
638
|
+
};
|
|
639
|
+
if (status.status === "static") {
|
|
640
|
+
const value = status.numericExpression === undefined ? status.codeValue : evaluateSourceNumericValue(status.numericExpression, config);
|
|
641
|
+
return [
|
|
642
|
+
key,
|
|
643
|
+
status.numericExpression !== undefined && !Number.isFinite(value) ? { status: "computed" } : { ...status, ...timing, codeValue: value }
|
|
644
|
+
];
|
|
645
|
+
}
|
|
646
|
+
const keyframes = status.keyframes.map((keyframe) => ({
|
|
647
|
+
...keyframe,
|
|
648
|
+
frame: evaluateSourceNumericValue(keyframe.frame, config)
|
|
649
|
+
}));
|
|
650
|
+
if (keyframes.some((keyframe, index) => !Number.isFinite(keyframe.frame) || index > 0 && keyframe.frame <= keyframes[index - 1].frame)) {
|
|
651
|
+
return [key, { status: "computed" }];
|
|
652
|
+
}
|
|
653
|
+
return [key, { ...status, ...timing, keyframes }];
|
|
654
|
+
}));
|
|
655
|
+
cached.set(configKey, result);
|
|
656
|
+
if (cached.size > 8)
|
|
657
|
+
cached.delete(cached.keys().next().value);
|
|
658
|
+
evaluatedProps.set(props, cached);
|
|
659
|
+
return result;
|
|
660
|
+
};
|
|
661
|
+
var NEWTON_ITERATIONS = 4;
|
|
662
|
+
var NEWTON_MIN_SLOPE = 0.001;
|
|
663
|
+
var SUBDIVISION_PRECISION = 0.0000001;
|
|
664
|
+
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
665
|
+
var kSplineTableSize = 11;
|
|
666
|
+
var kSampleStepSize = 1 / (kSplineTableSize - 1);
|
|
667
|
+
var float32ArraySupported = typeof Float32Array === "function";
|
|
668
|
+
function a(aA1, aA2) {
|
|
669
|
+
return 1 - 3 * aA2 + 3 * aA1;
|
|
543
670
|
}
|
|
544
|
-
function
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
671
|
+
function b(aA1, aA2) {
|
|
672
|
+
return 3 * aA2 - 6 * aA1;
|
|
673
|
+
}
|
|
674
|
+
function c(aA1) {
|
|
675
|
+
return 3 * aA1;
|
|
676
|
+
}
|
|
677
|
+
function calcBezier(aT, aA1, aA2) {
|
|
678
|
+
return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
|
|
679
|
+
}
|
|
680
|
+
function getSlope(aT, aA1, aA2) {
|
|
681
|
+
return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
|
|
682
|
+
}
|
|
683
|
+
function binarySubdivide({
|
|
684
|
+
aX,
|
|
685
|
+
_aA,
|
|
686
|
+
_aB,
|
|
687
|
+
mX1,
|
|
688
|
+
mX2
|
|
554
689
|
}) {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}) : undefined;
|
|
568
|
-
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
569
|
-
get: () => naturalDuration
|
|
570
|
-
} : {
|
|
571
|
-
get: () => {
|
|
572
|
-
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
690
|
+
let currentX;
|
|
691
|
+
let currentT;
|
|
692
|
+
let i = 0;
|
|
693
|
+
let aA = _aA;
|
|
694
|
+
let aB = _aB;
|
|
695
|
+
do {
|
|
696
|
+
currentT = aA + (aB - aA) / 2;
|
|
697
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
698
|
+
if (currentX > 0) {
|
|
699
|
+
aB = currentT;
|
|
700
|
+
} else {
|
|
701
|
+
aA = currentT;
|
|
573
702
|
}
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
577
|
-
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
578
|
-
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
579
|
-
return to;
|
|
580
|
-
}
|
|
581
|
-
const spr = springCalculation({
|
|
582
|
-
fps,
|
|
583
|
-
frame: durationProcessed,
|
|
584
|
-
config
|
|
585
|
-
});
|
|
586
|
-
const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
|
|
587
|
-
const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
|
|
588
|
-
return interpolated;
|
|
703
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
704
|
+
return currentT;
|
|
589
705
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
return n >= 1 ? 1 : 0;
|
|
600
|
-
}
|
|
601
|
-
static linear(t) {
|
|
602
|
-
return t;
|
|
603
|
-
}
|
|
604
|
-
static ease(t) {
|
|
605
|
-
easeBezier ??= Easing.bezier(0.42, 0, 1, 1);
|
|
606
|
-
return easeBezier(t);
|
|
607
|
-
}
|
|
608
|
-
static quad(t) {
|
|
609
|
-
return t * t;
|
|
610
|
-
}
|
|
611
|
-
static cubic(t) {
|
|
612
|
-
return t * t * t;
|
|
613
|
-
}
|
|
614
|
-
static poly(n) {
|
|
615
|
-
return (t) => t ** n;
|
|
616
|
-
}
|
|
617
|
-
static sin(t) {
|
|
618
|
-
return 1 - Math.cos(t * Math.PI / 2);
|
|
619
|
-
}
|
|
620
|
-
static circle(t) {
|
|
621
|
-
const u = clampUnit(t);
|
|
622
|
-
return 1 - Math.sqrt(1 - u * u);
|
|
706
|
+
function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) {
|
|
707
|
+
let aGuessT = _aGuessT;
|
|
708
|
+
for (let i = 0;i < NEWTON_ITERATIONS; ++i) {
|
|
709
|
+
const currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
710
|
+
if (currentSlope === 0) {
|
|
711
|
+
return aGuessT;
|
|
712
|
+
}
|
|
713
|
+
const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
714
|
+
aGuessT -= currentX / currentSlope;
|
|
623
715
|
}
|
|
624
|
-
|
|
625
|
-
|
|
716
|
+
return aGuessT;
|
|
717
|
+
}
|
|
718
|
+
function bezier(mX1, mY1, mX2, mY2) {
|
|
719
|
+
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
|
720
|
+
throw new Error("bezier x values must be in [0, 1] range");
|
|
626
721
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
722
|
+
const sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
|
723
|
+
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
724
|
+
for (let i = 0;i < kSplineTableSize; ++i) {
|
|
725
|
+
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
726
|
+
}
|
|
630
727
|
}
|
|
631
|
-
|
|
632
|
-
|
|
728
|
+
function getTForX(aX) {
|
|
729
|
+
let intervalStart = 0;
|
|
730
|
+
let currentSample = 1;
|
|
731
|
+
const lastSample = kSplineTableSize - 1;
|
|
732
|
+
for (;currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
733
|
+
intervalStart += kSampleStepSize;
|
|
734
|
+
}
|
|
735
|
+
--currentSample;
|
|
736
|
+
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
737
|
+
const guessForT = intervalStart + dist * kSampleStepSize;
|
|
738
|
+
const initialSlope = getSlope(guessForT, mX1, mX2);
|
|
739
|
+
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
740
|
+
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
741
|
+
}
|
|
742
|
+
if (initialSlope === 0) {
|
|
743
|
+
return guessForT;
|
|
744
|
+
}
|
|
745
|
+
return binarySubdivide({
|
|
746
|
+
aX,
|
|
747
|
+
_aA: intervalStart,
|
|
748
|
+
_aB: intervalStart + kSampleStepSize,
|
|
749
|
+
mX1,
|
|
750
|
+
mX2
|
|
751
|
+
});
|
|
633
752
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
} = {}) {
|
|
639
|
-
const easing = (t) => {
|
|
640
|
-
if (t <= 0) {
|
|
641
|
-
return 0;
|
|
642
|
-
}
|
|
643
|
-
if (!allowTail && t >= 1) {
|
|
644
|
-
return 1;
|
|
645
|
-
}
|
|
646
|
-
if (allowTail) {
|
|
647
|
-
return spring({
|
|
648
|
-
fps: springEasingDurationInFrames,
|
|
649
|
-
frame: t * measureSpring({
|
|
650
|
-
fps: springEasingDurationInFrames,
|
|
651
|
-
config,
|
|
652
|
-
threshold: durationRestThreshold
|
|
653
|
-
}),
|
|
654
|
-
config
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
return spring({
|
|
658
|
-
fps: springEasingDurationInFrames,
|
|
659
|
-
frame: t * springEasingDurationInFrames,
|
|
660
|
-
config,
|
|
661
|
-
durationInFrames: springEasingDurationInFrames,
|
|
662
|
-
durationRestThreshold
|
|
663
|
-
});
|
|
664
|
-
};
|
|
665
|
-
return Object.assign(easing, {
|
|
666
|
-
remotionShouldExtendRight: allowTail
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
static bounce(t) {
|
|
670
|
-
const u = clampUnit(t);
|
|
671
|
-
if (u < 1 / 2.75) {
|
|
672
|
-
return 7.5625 * u * u;
|
|
753
|
+
return function(x) {
|
|
754
|
+
const clampedX = Math.min(1, Math.max(0, x));
|
|
755
|
+
if (mX1 === mY1 && mX2 === mY2) {
|
|
756
|
+
return clampedX;
|
|
673
757
|
}
|
|
674
|
-
if (
|
|
675
|
-
|
|
676
|
-
return 7.5625 * t2_ * t2_ + 0.75;
|
|
758
|
+
if (clampedX === 0) {
|
|
759
|
+
return 0;
|
|
677
760
|
}
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
761
|
+
if (clampedX === 1) {
|
|
762
|
+
return 1;
|
|
681
763
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
static bezier(x1, y1, x2, y2) {
|
|
686
|
-
return bezier(x1, y1, x2, y2);
|
|
687
|
-
}
|
|
688
|
-
static in(easing) {
|
|
689
|
-
return easing;
|
|
690
|
-
}
|
|
691
|
-
static out(easing) {
|
|
692
|
-
return (t) => 1 - easing(1 - t);
|
|
693
|
-
}
|
|
694
|
-
static inOut(easing) {
|
|
695
|
-
return (t) => {
|
|
696
|
-
if (t < 0.5) {
|
|
697
|
-
return easing(t * 2) / 2;
|
|
698
|
-
}
|
|
699
|
-
return 1 - easing((1 - t) * 2) / 2;
|
|
700
|
-
};
|
|
701
|
-
}
|
|
764
|
+
return calcBezier(getTForX(clampedX), mY1, mY2);
|
|
765
|
+
};
|
|
702
766
|
}
|
|
703
767
|
var normalizeNumber = (value) => {
|
|
704
768
|
return Math.round(value * 1e6) / 1e6;
|
|
@@ -1330,7 +1394,7 @@ var interpolateDiscreteValue = ({
|
|
|
1330
1394
|
if (resolveEasingForSegment({
|
|
1331
1395
|
easing: options?.easing,
|
|
1332
1396
|
segmentIndex
|
|
1333
|
-
}) !==
|
|
1397
|
+
}) !== Easing2.step1) {
|
|
1334
1398
|
throw new TypeError(typeof outputRange[0] === "boolean" ? "Booleans can only be interpolated using Easing.step1" : "Non-numeric strings can only be interpolated using Easing.step1");
|
|
1335
1399
|
}
|
|
1336
1400
|
}
|
|
@@ -1410,7 +1474,7 @@ function checkInfiniteRange(name, arr) {
|
|
|
1410
1474
|
}
|
|
1411
1475
|
}
|
|
1412
1476
|
}
|
|
1413
|
-
function
|
|
1477
|
+
function assertValidInterpolateEasingOption2(easing, inputRangeLength) {
|
|
1414
1478
|
if (easing === undefined) {
|
|
1415
1479
|
return;
|
|
1416
1480
|
}
|
|
@@ -1427,7 +1491,7 @@ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
|
|
|
1427
1491
|
}
|
|
1428
1492
|
}
|
|
1429
1493
|
}
|
|
1430
|
-
function
|
|
1494
|
+
function assertValidInterpolatePosterizeOption2(posterize) {
|
|
1431
1495
|
if (posterize === undefined) {
|
|
1432
1496
|
return;
|
|
1433
1497
|
}
|
|
@@ -1447,7 +1511,7 @@ function assertValidInterpolateOutputType(outputType) {
|
|
|
1447
1511
|
}
|
|
1448
1512
|
throw new Error(\`outputType must be "font-weight", "scale", "translate", "rotate", or "transform-origin", but got \${String(outputType)}\`);
|
|
1449
1513
|
}
|
|
1450
|
-
function
|
|
1514
|
+
function interpolate2(input, inputRange, outputRange, options) {
|
|
1451
1515
|
if (typeof input === "undefined") {
|
|
1452
1516
|
throw new Error("input can not be undefined");
|
|
1453
1517
|
}
|
|
@@ -1462,8 +1526,8 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
1462
1526
|
}
|
|
1463
1527
|
checkInfiniteRange("inputRange", inputRange);
|
|
1464
1528
|
checkValidInputRange(inputRange);
|
|
1465
|
-
|
|
1466
|
-
|
|
1529
|
+
assertValidInterpolateEasingOption2(options?.easing, inputRange.length);
|
|
1530
|
+
assertValidInterpolatePosterizeOption2(options?.posterize);
|
|
1467
1531
|
assertValidInterpolateOutputOption(options?.output);
|
|
1468
1532
|
assertValidInterpolateOutputType(options?.outputType);
|
|
1469
1533
|
if (typeof input !== "number") {
|
|
@@ -1546,467 +1610,387 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
1546
1610
|
checkInfiniteRange("outputRange", outputRange);
|
|
1547
1611
|
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
1548
1612
|
}
|
|
1549
|
-
var
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
1554
|
-
throw new TypeError(\`defaultPremountInSeconds must be a finite, non-negative number, but got \${String(value)}.\`);
|
|
1555
|
-
}
|
|
1556
|
-
};
|
|
1557
|
-
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
1558
|
-
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
1559
|
-
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
1560
|
-
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
1561
|
-
var findPropsToDelete = ({
|
|
1562
|
-
schema,
|
|
1563
|
-
key,
|
|
1564
|
-
value
|
|
1613
|
+
var validateFrame = ({
|
|
1614
|
+
allowFloats,
|
|
1615
|
+
durationInFrames,
|
|
1616
|
+
frame
|
|
1565
1617
|
}) => {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
throw new Error("Key " + JSON.stringify(key) + " not found in schema");
|
|
1618
|
+
if (typeof frame === "undefined") {
|
|
1619
|
+
throw new TypeError(\`Argument missing for parameter "frame"\`);
|
|
1569
1620
|
}
|
|
1570
|
-
if (typeof
|
|
1571
|
-
throw new
|
|
1621
|
+
if (typeof frame !== "number") {
|
|
1622
|
+
throw new TypeError(\`Argument passed for "frame" is not a number: \${frame}\`);
|
|
1572
1623
|
}
|
|
1573
|
-
if (
|
|
1574
|
-
throw new
|
|
1624
|
+
if (!Number.isFinite(frame)) {
|
|
1625
|
+
throw new RangeError(\`Frame \${frame} is not finite\`);
|
|
1575
1626
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
|
|
1627
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
1628
|
+
throw new RangeError(\`Argument for frame must be an integer, but got \${frame}\`);
|
|
1579
1629
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
for (const variant of otherVariants) {
|
|
1583
|
-
const otherVariant = fieldSchema.variants[variant];
|
|
1584
|
-
const keys = Object.keys(otherVariant);
|
|
1585
|
-
for (const k of keys) {
|
|
1586
|
-
otherKeys.add(k);
|
|
1587
|
-
}
|
|
1630
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
1631
|
+
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the lowest frame that can be rendered is \${-durationInFrames}\`);
|
|
1588
1632
|
}
|
|
1589
|
-
|
|
1590
|
-
};
|
|
1591
|
-
var registeredFontFaces = [];
|
|
1592
|
-
var fontDataByUrl = new Map;
|
|
1593
|
-
var fetchFontData = (fontUrl) => {
|
|
1594
|
-
const cached = fontDataByUrl.get(fontUrl);
|
|
1595
|
-
if (cached) {
|
|
1596
|
-
return cached;
|
|
1633
|
+
if (frame > durationInFrames - 1) {
|
|
1634
|
+
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the highest frame that can be rendered is \${durationInFrames - 1}\`);
|
|
1597
1635
|
}
|
|
1598
|
-
const promise = fetch(fontUrl).then((response) => {
|
|
1599
|
-
if (!response.ok) {
|
|
1600
|
-
throw new Error(\`Failed to load font \${JSON.stringify(fontUrl)}: \${response.status} \${response.statusText}\`);
|
|
1601
|
-
}
|
|
1602
|
-
return response.arrayBuffer();
|
|
1603
|
-
}).catch((error) => {
|
|
1604
|
-
fontDataByUrl.delete(fontUrl);
|
|
1605
|
-
throw error;
|
|
1606
|
-
});
|
|
1607
|
-
fontDataByUrl.set(fontUrl, promise);
|
|
1608
|
-
return promise;
|
|
1609
1636
|
};
|
|
1610
|
-
var
|
|
1611
|
-
if (
|
|
1637
|
+
var validateSpringDuration = (dur) => {
|
|
1638
|
+
if (typeof dur === "undefined") {
|
|
1612
1639
|
return;
|
|
1613
1640
|
}
|
|
1614
|
-
|
|
1615
|
-
};
|
|
1616
|
-
var getRegisteredFontFaces = () => {
|
|
1617
|
-
return registeredFontFaces.slice();
|
|
1618
|
-
};
|
|
1619
|
-
var DATE_TOKEN = "remotion-date:";
|
|
1620
|
-
var FILE_TOKEN = "remotion-file:";
|
|
1621
|
-
var serializeJSONWithSpecialTypes = ({
|
|
1622
|
-
data,
|
|
1623
|
-
indent,
|
|
1624
|
-
staticBase
|
|
1625
|
-
}) => {
|
|
1626
|
-
let customDateUsed = false;
|
|
1627
|
-
let customFileUsed = false;
|
|
1628
|
-
let mapUsed = false;
|
|
1629
|
-
let setUsed = false;
|
|
1630
|
-
try {
|
|
1631
|
-
const serializedString = JSON.stringify(data, function(key, value) {
|
|
1632
|
-
const item = this[key];
|
|
1633
|
-
if (item instanceof Date) {
|
|
1634
|
-
customDateUsed = true;
|
|
1635
|
-
return \`\${DATE_TOKEN}\${item.toISOString()}\`;
|
|
1636
|
-
}
|
|
1637
|
-
if (item instanceof Map) {
|
|
1638
|
-
mapUsed = true;
|
|
1639
|
-
return value;
|
|
1640
|
-
}
|
|
1641
|
-
if (item instanceof Set) {
|
|
1642
|
-
setUsed = true;
|
|
1643
|
-
return value;
|
|
1644
|
-
}
|
|
1645
|
-
if (typeof item === "string" && staticBase !== null && staticBase !== "" && item.startsWith(staticBase)) {
|
|
1646
|
-
customFileUsed = true;
|
|
1647
|
-
return \`\${FILE_TOKEN}\${item.replace(staticBase + "/", "")}\`;
|
|
1648
|
-
}
|
|
1649
|
-
return value;
|
|
1650
|
-
}, indent);
|
|
1651
|
-
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
1652
|
-
} catch (err) {
|
|
1653
|
-
throw new Error("Could not serialize the passed input props to JSON: " + err.message);
|
|
1641
|
+
if (typeof dur !== "number") {
|
|
1642
|
+
throw new TypeError(\`A "duration" of a spring must be a "number" but is "\${typeof dur}"\`);
|
|
1654
1643
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
const encodedName = value.replace(FILE_TOKEN, "");
|
|
1658
|
-
let name = encodedName;
|
|
1659
|
-
try {
|
|
1660
|
-
name = encodedName.split("/").map(decodeURIComponent).join("/");
|
|
1661
|
-
} catch {}
|
|
1662
|
-
const matchingStaticFile = window.remotion_staticFiles?.find((file) => file.name === name);
|
|
1663
|
-
if (matchingStaticFile) {
|
|
1664
|
-
return matchingStaticFile.src;
|
|
1644
|
+
if (Number.isNaN(dur)) {
|
|
1645
|
+
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
1665
1646
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
return new Date(value.replace(DATE_TOKEN, ""));
|
|
1672
|
-
}
|
|
1673
|
-
if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
|
|
1674
|
-
return resolveFileTokenToUrl(value);
|
|
1675
|
-
}
|
|
1676
|
-
return value;
|
|
1677
|
-
});
|
|
1678
|
-
};
|
|
1679
|
-
var transformSchema = {
|
|
1680
|
-
"style.transformOrigin": {
|
|
1681
|
-
type: "transform-origin",
|
|
1682
|
-
step: 1,
|
|
1683
|
-
default: "50% 50%",
|
|
1684
|
-
description: "Transform origin"
|
|
1685
|
-
},
|
|
1686
|
-
"style.translate": {
|
|
1687
|
-
type: "translate",
|
|
1688
|
-
step: 1,
|
|
1689
|
-
default: "0px 0px",
|
|
1690
|
-
description: "Offset"
|
|
1691
|
-
},
|
|
1692
|
-
"style.scale": {
|
|
1693
|
-
type: "scale",
|
|
1694
|
-
max: 100,
|
|
1695
|
-
step: 0.01,
|
|
1696
|
-
default: 1,
|
|
1697
|
-
description: "Scale",
|
|
1698
|
-
defaultKeyframeOutput: "perceptual-scale"
|
|
1699
|
-
},
|
|
1700
|
-
"style.rotate": {
|
|
1701
|
-
type: "rotation-css",
|
|
1702
|
-
step: 1,
|
|
1703
|
-
default: "0deg",
|
|
1704
|
-
description: "Rotation"
|
|
1705
|
-
},
|
|
1706
|
-
"style.opacity": {
|
|
1707
|
-
type: "number",
|
|
1708
|
-
min: 0,
|
|
1709
|
-
max: 1,
|
|
1710
|
-
step: 0.01,
|
|
1711
|
-
default: 1,
|
|
1712
|
-
description: "Opacity",
|
|
1713
|
-
hiddenFromList: false
|
|
1647
|
+
if (!Number.isFinite(dur)) {
|
|
1648
|
+
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
1649
|
+
}
|
|
1650
|
+
if (dur <= 0) {
|
|
1651
|
+
throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
|
|
1714
1652
|
}
|
|
1715
1653
|
};
|
|
1716
|
-
var
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1654
|
+
var defaultSpringConfig = {
|
|
1655
|
+
damping: 10,
|
|
1656
|
+
mass: 1,
|
|
1657
|
+
stiffness: 100,
|
|
1658
|
+
overshootClamping: false
|
|
1659
|
+
};
|
|
1660
|
+
var advanceCache = {};
|
|
1661
|
+
function advance({
|
|
1662
|
+
animation,
|
|
1663
|
+
now,
|
|
1664
|
+
config
|
|
1665
|
+
}) {
|
|
1666
|
+
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
1667
|
+
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
1668
|
+
if (config.damping <= 0) {
|
|
1669
|
+
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
1670
|
+
}
|
|
1671
|
+
const c = config.damping;
|
|
1672
|
+
const m = config.mass;
|
|
1673
|
+
const k = config.stiffness;
|
|
1674
|
+
const cacheKey = [
|
|
1675
|
+
toValue,
|
|
1676
|
+
lastTimestamp,
|
|
1677
|
+
current,
|
|
1678
|
+
velocity,
|
|
1679
|
+
c,
|
|
1680
|
+
m,
|
|
1681
|
+
k,
|
|
1682
|
+
now
|
|
1683
|
+
].join("-");
|
|
1684
|
+
if (advanceCache[cacheKey]) {
|
|
1685
|
+
return advanceCache[cacheKey];
|
|
1686
|
+
}
|
|
1687
|
+
const v0 = -velocity;
|
|
1688
|
+
const x0 = toValue - current;
|
|
1689
|
+
const zeta = c / (2 * Math.sqrt(k * m));
|
|
1690
|
+
const omega0 = Math.sqrt(k / m);
|
|
1691
|
+
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
1692
|
+
const t = deltaTime / 1000;
|
|
1693
|
+
const sin1 = Math.sin(omega1 * t);
|
|
1694
|
+
const cos1 = Math.cos(omega1 * t);
|
|
1695
|
+
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
1696
|
+
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
1697
|
+
const underDampedPosition = toValue - underDampedFrag1;
|
|
1698
|
+
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
1699
|
+
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
1700
|
+
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
1701
|
+
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
1702
|
+
const animationNode = {
|
|
1703
|
+
toValue,
|
|
1704
|
+
prevPosition: current,
|
|
1705
|
+
lastTimestamp: now,
|
|
1706
|
+
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
1707
|
+
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
1708
|
+
};
|
|
1709
|
+
advanceCache[cacheKey] = animationNode;
|
|
1710
|
+
return animationNode;
|
|
1711
|
+
}
|
|
1712
|
+
var calculationCache = {};
|
|
1713
|
+
function springCalculation({
|
|
1714
|
+
frame,
|
|
1715
|
+
fps,
|
|
1716
|
+
config = {}
|
|
1717
|
+
}) {
|
|
1718
|
+
const from = 0;
|
|
1719
|
+
const to = 1;
|
|
1720
|
+
const resolvedConfig = {
|
|
1721
|
+
damping: config.damping ?? defaultSpringConfig.damping,
|
|
1722
|
+
mass: config.mass ?? defaultSpringConfig.mass,
|
|
1723
|
+
stiffness: config.stiffness ?? defaultSpringConfig.stiffness,
|
|
1724
|
+
overshootClamping: config.overshootClamping ?? defaultSpringConfig.overshootClamping
|
|
1725
|
+
};
|
|
1726
|
+
const configKey = [
|
|
1727
|
+
fps,
|
|
1728
|
+
resolvedConfig.damping,
|
|
1729
|
+
resolvedConfig.mass,
|
|
1730
|
+
resolvedConfig.overshootClamping,
|
|
1731
|
+
resolvedConfig.stiffness
|
|
1732
|
+
].join("-");
|
|
1733
|
+
const cacheKey = \`\${frame}-\${configKey}\`;
|
|
1734
|
+
if (calculationCache[cacheKey]) {
|
|
1735
|
+
return calculationCache[cacheKey];
|
|
1736
|
+
}
|
|
1737
|
+
const frameClamped = Math.max(0, frame);
|
|
1738
|
+
const previousFrame = Math.ceil(frameClamped) - 1;
|
|
1739
|
+
const previousAnimation = previousFrame >= 0 ? calculationCache[\`\${previousFrame}-\${configKey}\`] : undefined;
|
|
1740
|
+
let animation = previousAnimation ?? {
|
|
1741
|
+
lastTimestamp: 0,
|
|
1742
|
+
current: from,
|
|
1743
|
+
toValue: to,
|
|
1744
|
+
velocity: 0,
|
|
1745
|
+
prevPosition: 0
|
|
1746
|
+
};
|
|
1747
|
+
const unevenRest = frameClamped % 1;
|
|
1748
|
+
const startFrame = previousAnimation ? previousFrame + 1 : 0;
|
|
1749
|
+
for (let f = startFrame;f <= Math.floor(frameClamped); f++) {
|
|
1750
|
+
const time = f / fps * 1000;
|
|
1751
|
+
animation = advance({
|
|
1752
|
+
animation,
|
|
1753
|
+
now: time,
|
|
1754
|
+
config: resolvedConfig
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
if (unevenRest > 0) {
|
|
1758
|
+
animation = advance({
|
|
1759
|
+
animation,
|
|
1760
|
+
now: frameClamped / fps * 1000,
|
|
1761
|
+
config: resolvedConfig
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
calculationCache[cacheKey] = animation;
|
|
1765
|
+
return animation;
|
|
1766
|
+
}
|
|
1767
|
+
var cache = new Map;
|
|
1768
|
+
function measureSpring2({
|
|
1769
|
+
fps,
|
|
1770
|
+
config = {},
|
|
1771
|
+
threshold = 0.005
|
|
1772
|
+
}) {
|
|
1773
|
+
if (typeof threshold !== "number") {
|
|
1774
|
+
throw new TypeError(\`threshold must be a number, got \${threshold} of type \${typeof threshold}\`);
|
|
1775
|
+
}
|
|
1776
|
+
if (threshold === 0) {
|
|
1777
|
+
return Infinity;
|
|
1778
|
+
}
|
|
1779
|
+
if (threshold === 1) {
|
|
1780
|
+
return 0;
|
|
1781
|
+
}
|
|
1782
|
+
if (isNaN(threshold)) {
|
|
1783
|
+
throw new TypeError("Threshold is NaN");
|
|
1784
|
+
}
|
|
1785
|
+
if (!Number.isFinite(threshold)) {
|
|
1786
|
+
throw new TypeError("Threshold is not finite");
|
|
1787
|
+
}
|
|
1788
|
+
if (threshold < 0) {
|
|
1789
|
+
throw new TypeError("Threshold is below 0");
|
|
1790
|
+
}
|
|
1791
|
+
const cacheKey = [
|
|
1792
|
+
fps,
|
|
1793
|
+
config.damping,
|
|
1794
|
+
config.mass,
|
|
1795
|
+
config.overshootClamping,
|
|
1796
|
+
config.stiffness,
|
|
1797
|
+
threshold
|
|
1798
|
+
].join("-");
|
|
1799
|
+
if (cache.has(cacheKey)) {
|
|
1800
|
+
return cache.get(cacheKey);
|
|
1801
|
+
}
|
|
1802
|
+
validateFps(fps, "to the measureSpring() function", false);
|
|
1803
|
+
let frame = 0;
|
|
1804
|
+
let finishedFrame = 0;
|
|
1805
|
+
const calc = () => {
|
|
1806
|
+
return springCalculation({
|
|
1807
|
+
fps,
|
|
1808
|
+
frame,
|
|
1809
|
+
config
|
|
1810
|
+
});
|
|
1811
|
+
};
|
|
1812
|
+
let animation = calc();
|
|
1813
|
+
const calcDifference = () => {
|
|
1814
|
+
return Math.abs(animation.current - animation.toValue);
|
|
1815
|
+
};
|
|
1816
|
+
let difference = calcDifference();
|
|
1817
|
+
while (difference >= threshold) {
|
|
1818
|
+
frame++;
|
|
1819
|
+
animation = calc();
|
|
1820
|
+
difference = calcDifference();
|
|
1821
|
+
}
|
|
1822
|
+
finishedFrame = frame;
|
|
1823
|
+
for (let i = 0;i < 20; i++) {
|
|
1824
|
+
frame++;
|
|
1825
|
+
animation = calc();
|
|
1826
|
+
difference = calcDifference();
|
|
1827
|
+
if (difference >= threshold) {
|
|
1828
|
+
i = 0;
|
|
1829
|
+
finishedFrame = frame + 1;
|
|
1740
1830
|
}
|
|
1741
|
-
},
|
|
1742
|
-
"style.borderColor": {
|
|
1743
|
-
type: "color",
|
|
1744
|
-
default: undefined,
|
|
1745
|
-
description: "Border color"
|
|
1746
1831
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1832
|
+
cache.set(cacheKey, finishedFrame);
|
|
1833
|
+
return finishedFrame;
|
|
1834
|
+
}
|
|
1835
|
+
function spring2({
|
|
1836
|
+
frame: passedFrame,
|
|
1837
|
+
fps,
|
|
1838
|
+
config = {},
|
|
1839
|
+
from = 0,
|
|
1840
|
+
to = 1,
|
|
1841
|
+
durationInFrames: passedDurationInFrames,
|
|
1842
|
+
durationRestThreshold,
|
|
1843
|
+
delay = 0,
|
|
1844
|
+
reverse = false
|
|
1845
|
+
}) {
|
|
1846
|
+
validateSpringDuration(passedDurationInFrames);
|
|
1847
|
+
validateFrame({
|
|
1848
|
+
frame: passedFrame,
|
|
1849
|
+
durationInFrames: Infinity,
|
|
1850
|
+
allowFloats: true
|
|
1851
|
+
});
|
|
1852
|
+
validateFps(fps, "to spring()", false);
|
|
1853
|
+
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
1854
|
+
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring2({
|
|
1855
|
+
fps,
|
|
1856
|
+
config,
|
|
1857
|
+
threshold: durationRestThreshold
|
|
1858
|
+
}) : undefined;
|
|
1859
|
+
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
1860
|
+
get: () => naturalDuration
|
|
1861
|
+
} : {
|
|
1862
|
+
get: () => {
|
|
1863
|
+
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
1867
|
+
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
1868
|
+
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
1869
|
+
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
1870
|
+
return to;
|
|
1871
|
+
}
|
|
1872
|
+
const spr = springCalculation({
|
|
1873
|
+
fps,
|
|
1874
|
+
frame: durationProcessed,
|
|
1875
|
+
config
|
|
1876
|
+
});
|
|
1877
|
+
const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
|
|
1878
|
+
const interpolated = from === 0 && to === 1 ? inner : interpolate2(inner, [0, 1], [from, to]);
|
|
1879
|
+
return interpolated;
|
|
1880
|
+
}
|
|
1881
|
+
var clampUnit = (t) => Math.min(1, Math.max(0, t));
|
|
1882
|
+
var springEasingDurationInFrames = 30;
|
|
1883
|
+
var easeBezier = null;
|
|
1884
|
+
|
|
1885
|
+
class Easing2 {
|
|
1886
|
+
static step0(n) {
|
|
1887
|
+
return n > 0 ? 1 : 0;
|
|
1789
1888
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
"style.backgroundColor": {
|
|
1793
|
-
type: "color",
|
|
1794
|
-
default: "transparent",
|
|
1795
|
-
description: "Color"
|
|
1889
|
+
static step1(n) {
|
|
1890
|
+
return n >= 1 ? 1 : 0;
|
|
1796
1891
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
color: {
|
|
1800
|
-
type: "color",
|
|
1801
|
-
default: undefined,
|
|
1802
|
-
description: "Current color"
|
|
1892
|
+
static linear(t) {
|
|
1893
|
+
return t;
|
|
1803
1894
|
}
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
stroke: {
|
|
1808
|
-
type: "color",
|
|
1809
|
-
default: "none",
|
|
1810
|
-
description: "Stroke"
|
|
1811
|
-
},
|
|
1812
|
-
strokeWidth: {
|
|
1813
|
-
type: "number",
|
|
1814
|
-
default: 1,
|
|
1815
|
-
description: "Stroke width",
|
|
1816
|
-
min: 0,
|
|
1817
|
-
step: 1,
|
|
1818
|
-
hiddenFromList: false
|
|
1895
|
+
static ease(t) {
|
|
1896
|
+
easeBezier ??= Easing2.bezier(0.42, 0, 1, 1);
|
|
1897
|
+
return easeBezier(t);
|
|
1819
1898
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
fill: {
|
|
1823
|
-
type: "color",
|
|
1824
|
-
default: undefined,
|
|
1825
|
-
description: "Fill"
|
|
1826
|
-
},
|
|
1827
|
-
...svgStrokeSchema
|
|
1828
|
-
};
|
|
1829
|
-
var premountSchema = {
|
|
1830
|
-
premountFor: {
|
|
1831
|
-
type: "number",
|
|
1832
|
-
default: undefined,
|
|
1833
|
-
description: "Premount For",
|
|
1834
|
-
min: 0,
|
|
1835
|
-
step: 1,
|
|
1836
|
-
hiddenFromList: false,
|
|
1837
|
-
keyframable: false
|
|
1838
|
-
},
|
|
1839
|
-
postmountFor: {
|
|
1840
|
-
type: "number",
|
|
1841
|
-
default: 0,
|
|
1842
|
-
min: 0,
|
|
1843
|
-
step: 1,
|
|
1844
|
-
hiddenFromList: true,
|
|
1845
|
-
keyframable: false
|
|
1899
|
+
static quad(t) {
|
|
1900
|
+
return t * t;
|
|
1846
1901
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
...premountSchema
|
|
1850
|
-
};
|
|
1851
|
-
var cropSchema = {
|
|
1852
|
-
cropLeft: {
|
|
1853
|
-
type: "number",
|
|
1854
|
-
default: 0,
|
|
1855
|
-
description: "Crop left",
|
|
1856
|
-
min: 0,
|
|
1857
|
-
max: 1,
|
|
1858
|
-
step: 0.01,
|
|
1859
|
-
hiddenFromList: false,
|
|
1860
|
-
keyframable: true
|
|
1861
|
-
},
|
|
1862
|
-
cropRight: {
|
|
1863
|
-
type: "number",
|
|
1864
|
-
default: 0,
|
|
1865
|
-
description: "Crop right",
|
|
1866
|
-
min: 0,
|
|
1867
|
-
max: 1,
|
|
1868
|
-
step: 0.01,
|
|
1869
|
-
hiddenFromList: false,
|
|
1870
|
-
keyframable: true
|
|
1871
|
-
},
|
|
1872
|
-
cropTop: {
|
|
1873
|
-
type: "number",
|
|
1874
|
-
default: 0,
|
|
1875
|
-
description: "Crop top",
|
|
1876
|
-
min: 0,
|
|
1877
|
-
max: 1,
|
|
1878
|
-
step: 0.01,
|
|
1879
|
-
hiddenFromList: false,
|
|
1880
|
-
keyframable: true
|
|
1881
|
-
},
|
|
1882
|
-
cropBottom: {
|
|
1883
|
-
type: "number",
|
|
1884
|
-
default: 0,
|
|
1885
|
-
description: "Crop bottom",
|
|
1886
|
-
min: 0,
|
|
1887
|
-
max: 1,
|
|
1888
|
-
step: 0.01,
|
|
1889
|
-
hiddenFromList: false,
|
|
1890
|
-
keyframable: true
|
|
1902
|
+
static cubic(t) {
|
|
1903
|
+
return t * t * t;
|
|
1891
1904
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
var sequenceStyleSchema = {
|
|
1895
|
-
...sequenceCropSchema,
|
|
1896
|
-
...transformSchema,
|
|
1897
|
-
...backgroundSchema,
|
|
1898
|
-
...borderSchema,
|
|
1899
|
-
...borderRadiusSchema,
|
|
1900
|
-
...sequencePremountSchema
|
|
1901
|
-
};
|
|
1902
|
-
var hiddenField = {
|
|
1903
|
-
type: "boolean",
|
|
1904
|
-
default: false,
|
|
1905
|
-
description: "Hidden"
|
|
1906
|
-
};
|
|
1907
|
-
var showInTimelineField = {
|
|
1908
|
-
type: "hidden"
|
|
1909
|
-
};
|
|
1910
|
-
var sequenceNameField = {
|
|
1911
|
-
type: "hidden"
|
|
1912
|
-
};
|
|
1913
|
-
var durationInFramesField = {
|
|
1914
|
-
type: "number",
|
|
1915
|
-
default: undefined,
|
|
1916
|
-
min: 1,
|
|
1917
|
-
step: 1,
|
|
1918
|
-
hiddenFromList: true
|
|
1919
|
-
};
|
|
1920
|
-
var fromField = {
|
|
1921
|
-
type: "number",
|
|
1922
|
-
default: 0,
|
|
1923
|
-
step: 1,
|
|
1924
|
-
hiddenFromList: true
|
|
1925
|
-
};
|
|
1926
|
-
var trimBeforeField = {
|
|
1927
|
-
type: "number",
|
|
1928
|
-
default: 0,
|
|
1929
|
-
min: 0,
|
|
1930
|
-
step: 1,
|
|
1931
|
-
hiddenFromList: true
|
|
1932
|
-
};
|
|
1933
|
-
var sequenceTimingSchema = {
|
|
1934
|
-
from: {
|
|
1935
|
-
...fromField,
|
|
1936
|
-
description: "From",
|
|
1937
|
-
hiddenFromList: false,
|
|
1938
|
-
keyframable: false
|
|
1939
|
-
},
|
|
1940
|
-
durationInFrames: {
|
|
1941
|
-
...durationInFramesField,
|
|
1942
|
-
description: "Duration",
|
|
1943
|
-
hiddenFromList: false,
|
|
1944
|
-
keyframable: false
|
|
1945
|
-
},
|
|
1946
|
-
trimBefore: {
|
|
1947
|
-
...trimBeforeField,
|
|
1948
|
-
description: "Trim before",
|
|
1949
|
-
hiddenFromList: false,
|
|
1950
|
-
keyframable: false
|
|
1905
|
+
static poly(n) {
|
|
1906
|
+
return (t) => t ** n;
|
|
1951
1907
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1908
|
+
static sin(t) {
|
|
1909
|
+
return 1 - Math.cos(t * Math.PI / 2);
|
|
1910
|
+
}
|
|
1911
|
+
static circle(t) {
|
|
1912
|
+
const u = clampUnit(t);
|
|
1913
|
+
return 1 - Math.sqrt(1 - u * u);
|
|
1914
|
+
}
|
|
1915
|
+
static exp(t) {
|
|
1916
|
+
return 2 ** (10 * (t - 1));
|
|
1917
|
+
}
|
|
1918
|
+
static elastic(bounciness = 1) {
|
|
1919
|
+
const p = bounciness * Math.PI;
|
|
1920
|
+
return (t) => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p);
|
|
1921
|
+
}
|
|
1922
|
+
static back(s = 1.70158) {
|
|
1923
|
+
return (t) => t * t * ((s + 1) * t - s);
|
|
1924
|
+
}
|
|
1925
|
+
static spring({
|
|
1926
|
+
allowTail = false,
|
|
1927
|
+
durationRestThreshold,
|
|
1928
|
+
...config
|
|
1929
|
+
} = {}) {
|
|
1930
|
+
const easing = (t) => {
|
|
1931
|
+
if (t <= 0) {
|
|
1932
|
+
return 0;
|
|
1933
|
+
}
|
|
1934
|
+
if (!allowTail && t >= 1) {
|
|
1935
|
+
return 1;
|
|
1936
|
+
}
|
|
1937
|
+
if (allowTail) {
|
|
1938
|
+
return spring2({
|
|
1939
|
+
fps: springEasingDurationInFrames,
|
|
1940
|
+
frame: t * measureSpring2({
|
|
1941
|
+
fps: springEasingDurationInFrames,
|
|
1942
|
+
config,
|
|
1943
|
+
threshold: durationRestThreshold
|
|
1944
|
+
}),
|
|
1945
|
+
config
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
return spring2({
|
|
1949
|
+
fps: springEasingDurationInFrames,
|
|
1950
|
+
frame: t * springEasingDurationInFrames,
|
|
1951
|
+
config,
|
|
1952
|
+
durationInFrames: springEasingDurationInFrames,
|
|
1953
|
+
durationRestThreshold
|
|
1954
|
+
});
|
|
1955
|
+
};
|
|
1956
|
+
return Object.assign(easing, {
|
|
1957
|
+
remotionShouldExtendRight: allowTail
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
static bounce(t) {
|
|
1961
|
+
const u = clampUnit(t);
|
|
1962
|
+
if (u < 1 / 2.75) {
|
|
1963
|
+
return 7.5625 * u * u;
|
|
1964
|
+
}
|
|
1965
|
+
if (u < 2 / 2.75) {
|
|
1966
|
+
const t2_ = u - 1.5 / 2.75;
|
|
1967
|
+
return 7.5625 * t2_ * t2_ + 0.75;
|
|
1968
|
+
}
|
|
1969
|
+
if (u < 2.5 / 2.75) {
|
|
1970
|
+
const t2_ = u - 2.25 / 2.75;
|
|
1971
|
+
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
1987
1972
|
}
|
|
1973
|
+
const t2 = u - 2.625 / 2.75;
|
|
1974
|
+
return 7.5625 * t2 * t2 + 0.984375;
|
|
1988
1975
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
durationInFrames: durationInFramesField,
|
|
1992
|
-
trimBefore: trimBeforeField,
|
|
1993
|
-
playbackRate: playbackRateField,
|
|
1994
|
-
freeze: freezeField,
|
|
1995
|
-
hidden: hiddenField,
|
|
1996
|
-
name: sequenceNameField,
|
|
1997
|
-
showInTimeline: showInTimelineField
|
|
1998
|
-
};
|
|
1999
|
-
var sequenceSchemaWithoutFrom = {
|
|
2000
|
-
...baseSchemaWithoutFrom,
|
|
2001
|
-
layout: sequenceSchema.layout
|
|
2002
|
-
};
|
|
2003
|
-
var sequenceSchemaDefaultLayoutNone = {
|
|
2004
|
-
...sequenceSchema,
|
|
2005
|
-
layout: {
|
|
2006
|
-
...sequenceSchema.layout,
|
|
2007
|
-
default: "none"
|
|
1976
|
+
static bezier(x1, y1, x2, y2) {
|
|
1977
|
+
return bezier(x1, y1, x2, y2);
|
|
2008
1978
|
}
|
|
2009
|
-
|
|
1979
|
+
static in(easing) {
|
|
1980
|
+
return easing;
|
|
1981
|
+
}
|
|
1982
|
+
static out(easing) {
|
|
1983
|
+
return (t) => 1 - easing(1 - t);
|
|
1984
|
+
}
|
|
1985
|
+
static inOut(easing) {
|
|
1986
|
+
return (t) => {
|
|
1987
|
+
if (t < 0.5) {
|
|
1988
|
+
return easing(t * 2) / 2;
|
|
1989
|
+
}
|
|
1990
|
+
return 1 - easing((1 - t) * 2) / 2;
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
2010
1994
|
var NUMBER = "[-+]?\\\\d*\\\\.?\\\\d+";
|
|
2011
1995
|
var PERCENTAGE = NUMBER + "%";
|
|
2012
1996
|
function call(...args) {
|
|
@@ -2458,88 +2442,57 @@ function processColor(color) {
|
|
|
2458
2442
|
const normalizedColor = normalizeColor(color);
|
|
2459
2443
|
return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
|
|
2460
2444
|
}
|
|
2461
|
-
var
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
var defaultScaleValue = [1, 1, 1];
|
|
2470
|
-
var parseScaleString = (value) => {
|
|
2471
|
-
const parts = value.trim().split(/\\s+/);
|
|
2472
|
-
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
2473
|
-
return null;
|
|
2445
|
+
var findPropsToDelete = ({
|
|
2446
|
+
schema,
|
|
2447
|
+
key,
|
|
2448
|
+
value
|
|
2449
|
+
}) => {
|
|
2450
|
+
const fieldSchema = schema[key];
|
|
2451
|
+
if (!fieldSchema) {
|
|
2452
|
+
throw new Error("Key " + JSON.stringify(key) + " not found in schema");
|
|
2474
2453
|
}
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
return null;
|
|
2454
|
+
if (typeof value !== "string") {
|
|
2455
|
+
throw new Error("Value must be a string, but is " + JSON.stringify(value));
|
|
2478
2456
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
const z = parsed[2] ?? 1;
|
|
2482
|
-
return [x, y, z];
|
|
2483
|
-
};
|
|
2484
|
-
var parseValidScaleValue = (value) => {
|
|
2485
|
-
if (typeof value === "number") {
|
|
2486
|
-
return Number.isFinite(value) ? [value, value, 1] : null;
|
|
2457
|
+
if (fieldSchema.type !== "enum") {
|
|
2458
|
+
throw new Error("Key " + JSON.stringify(key) + " is not an enum");
|
|
2487
2459
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2460
|
+
const currentVariant = fieldSchema.variants[value];
|
|
2461
|
+
if (!currentVariant) {
|
|
2462
|
+
throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
|
|
2490
2463
|
}
|
|
2491
|
-
|
|
2464
|
+
const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
|
|
2465
|
+
const otherKeys = new Set;
|
|
2466
|
+
for (const variant of otherVariants) {
|
|
2467
|
+
const otherVariant = fieldSchema.variants[variant];
|
|
2468
|
+
const keys = Object.keys(otherVariant);
|
|
2469
|
+
for (const k of keys) {
|
|
2470
|
+
otherKeys.add(k);
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
return [...otherKeys];
|
|
2492
2474
|
};
|
|
2493
|
-
var
|
|
2494
|
-
|
|
2475
|
+
var validatePreferredEffectBackend = (value) => {
|
|
2476
|
+
if (value !== "auto" && value !== "webgpu" && value !== "webgl2" && value !== "2d") {
|
|
2477
|
+
throw new TypeError(\`preferredEffectBackend must be "auto", "webgpu", "webgl2" or "2d", got \${String(value)}\`);
|
|
2478
|
+
}
|
|
2479
|
+
return value;
|
|
2495
2480
|
};
|
|
2496
|
-
var
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
const normalizedZ = normalizeNumber(z);
|
|
2500
|
-
if (normalizedX === normalizedY && normalizedZ === 1) {
|
|
2501
|
-
return normalizedX;
|
|
2481
|
+
var getAbsoluteSrc = (relativeSrc) => {
|
|
2482
|
+
if (typeof window === "undefined") {
|
|
2483
|
+
return relativeSrc;
|
|
2502
2484
|
}
|
|
2503
|
-
if (
|
|
2504
|
-
return
|
|
2485
|
+
if (relativeSrc.startsWith("http://") || relativeSrc.startsWith("https://") || relativeSrc.startsWith("file://") || relativeSrc.startsWith("blob:") || relativeSrc.startsWith("data:")) {
|
|
2486
|
+
return relativeSrc;
|
|
2505
2487
|
}
|
|
2506
|
-
return
|
|
2488
|
+
return new URL(relativeSrc, document.baseURI).href;
|
|
2507
2489
|
};
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
frames,
|
|
2513
|
-
durationInFrames
|
|
2490
|
+
var getExpectedMediaFrameUncorrected = ({
|
|
2491
|
+
frame,
|
|
2492
|
+
playbackRate,
|
|
2493
|
+
startFrom
|
|
2514
2494
|
}) => {
|
|
2515
|
-
|
|
2516
|
-
throw new TypeError("The \`frames\` option must be an array of frame numbers.");
|
|
2517
|
-
}
|
|
2518
|
-
if (frames.length === 0) {
|
|
2519
|
-
throw new TypeError("The \`frames\` option must contain at least one frame.");
|
|
2520
|
-
}
|
|
2521
|
-
for (const frame of frames) {
|
|
2522
|
-
if (typeof frame !== "number") {
|
|
2523
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only numbers, but got \${typeof frame}.\`);
|
|
2524
|
-
}
|
|
2525
|
-
if (!Number.isFinite(frame)) {
|
|
2526
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only finite numbers, but got \${frame}.\`);
|
|
2527
|
-
}
|
|
2528
|
-
if (!Number.isInteger(frame)) {
|
|
2529
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only integers, but got \${frame}.\`);
|
|
2530
|
-
}
|
|
2531
|
-
if (frame < 0) {
|
|
2532
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only non-negative numbers, but got \${frame}.\`);
|
|
2533
|
-
}
|
|
2534
|
-
if (durationInFrames !== null && frame >= durationInFrames) {
|
|
2535
|
-
throw new RangeError(\`Frame \${frame} is out of range, must be between 0 and \${durationInFrames - 1}.\`);
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
const uniqueFrames = new Set(frames);
|
|
2539
|
-
if (uniqueFrames.size !== frames.length) {
|
|
2540
|
-
throw new TypeError("The \`frames\` option must not contain duplicate frames.");
|
|
2541
|
-
}
|
|
2542
|
-
return [...frames].sort((a, b) => a - b);
|
|
2495
|
+
return interpolate2(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
2543
2496
|
};
|
|
2544
2497
|
var validCodecs = [
|
|
2545
2498
|
"h264",
|
|
@@ -2566,77 +2519,123 @@ function validateCodec(defaultCodec, location, name) {
|
|
|
2566
2519
|
throw new Error(\`The "\${name}" prop \${location} must be one of \${validCodecs.join(", ")}, but you passed \${defaultCodec}.\`);
|
|
2567
2520
|
}
|
|
2568
2521
|
}
|
|
2569
|
-
var
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
}
|
|
2576
|
-
if (Array.isArray(defaultProps)) {
|
|
2577
|
-
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
2578
|
-
}
|
|
2522
|
+
var getOffthreadVideoSource = ({
|
|
2523
|
+
src,
|
|
2524
|
+
transparent,
|
|
2525
|
+
currentTime,
|
|
2526
|
+
toneMapped
|
|
2527
|
+
}) => {
|
|
2528
|
+
return \`http://localhost:\${window.remotion_proxyPort}/proxy?src=\${encodeURIComponent(getAbsoluteSrc(src))}&time=\${encodeURIComponent(Math.max(0, currentTime))}&transparent=\${String(transparent)}&toneMapped=\${String(toneMapped)}\`;
|
|
2579
2529
|
};
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
if (
|
|
2585
|
-
|
|
2586
|
-
}
|
|
2587
|
-
if (!Number.isFinite(amount)) {
|
|
2588
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
2589
|
-
}
|
|
2590
|
-
if (amount % 1 !== 0) {
|
|
2591
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
2592
|
-
}
|
|
2593
|
-
if (amount <= 0) {
|
|
2594
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be positive, but got \${amount}.\`);
|
|
2530
|
+
var registeredFontFaces = [];
|
|
2531
|
+
var fontDataByUrl = new Map;
|
|
2532
|
+
var fetchFontData = (fontUrl) => {
|
|
2533
|
+
const cached = fontDataByUrl.get(fontUrl);
|
|
2534
|
+
if (cached) {
|
|
2535
|
+
return cached;
|
|
2595
2536
|
}
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2537
|
+
const promise = fetch(fontUrl).then((response) => {
|
|
2538
|
+
if (!response.ok) {
|
|
2539
|
+
throw new Error(\`Failed to load font \${JSON.stringify(fontUrl)}: \${response.status} \${response.statusText}\`);
|
|
2540
|
+
}
|
|
2541
|
+
return response.arrayBuffer();
|
|
2542
|
+
}).catch((error) => {
|
|
2543
|
+
fontDataByUrl.delete(fontUrl);
|
|
2544
|
+
throw error;
|
|
2545
|
+
});
|
|
2546
|
+
fontDataByUrl.set(fontUrl, promise);
|
|
2547
|
+
return promise;
|
|
2548
|
+
};
|
|
2549
|
+
var registerFontFace = (fontFace) => {
|
|
2550
|
+
if (registeredFontFaces.some((registered) => registered.ascentOverride === fontFace.ascentOverride && registered.descentOverride === fontFace.descentOverride && registered.display === fontFace.display && registered.featureSettings === fontFace.featureSettings && registered.fontFamily === fontFace.fontFamily && registered.fontUrl === fontFace.fontUrl && registered.format === fontFace.format && registered.lineGapOverride === fontFace.lineGapOverride && registered.style === fontFace.style && registered.weight === fontFace.weight && registered.stretch === fontFace.stretch && registered.unicodeRange === fontFace.unicodeRange && registered.variant === fontFace.variant)) {
|
|
2551
|
+
return;
|
|
2601
2552
|
}
|
|
2602
|
-
|
|
2603
|
-
|
|
2553
|
+
registeredFontFaces.push(fontFace);
|
|
2554
|
+
};
|
|
2555
|
+
var getRegisteredFontFaces = () => {
|
|
2556
|
+
return registeredFontFaces.slice();
|
|
2557
|
+
};
|
|
2558
|
+
var proResProfileOptions = [
|
|
2559
|
+
"4444-xq",
|
|
2560
|
+
"4444",
|
|
2561
|
+
"hq",
|
|
2562
|
+
"standard",
|
|
2563
|
+
"light",
|
|
2564
|
+
"proxy"
|
|
2565
|
+
];
|
|
2566
|
+
var defaultScaleValue = [1, 1, 1];
|
|
2567
|
+
var parseScaleString = (value) => {
|
|
2568
|
+
const parts = value.trim().split(/\\s+/);
|
|
2569
|
+
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
2570
|
+
return null;
|
|
2604
2571
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2572
|
+
const parsed = parts.map((part) => Number(part));
|
|
2573
|
+
if (!parsed.every((part) => Number.isFinite(part))) {
|
|
2574
|
+
return null;
|
|
2607
2575
|
}
|
|
2608
|
-
|
|
2609
|
-
|
|
2576
|
+
const x = parsed[0];
|
|
2577
|
+
const y = parsed[1] ?? x;
|
|
2578
|
+
const z = parsed[2] ?? 1;
|
|
2579
|
+
return [x, y, z];
|
|
2580
|
+
};
|
|
2581
|
+
var parseValidScaleValue = (value) => {
|
|
2582
|
+
if (typeof value === "number") {
|
|
2583
|
+
return Number.isFinite(value) ? [value, value, 1] : null;
|
|
2610
2584
|
}
|
|
2611
|
-
if (
|
|
2612
|
-
|
|
2585
|
+
if (typeof value === "string") {
|
|
2586
|
+
return parseScaleString(value);
|
|
2613
2587
|
}
|
|
2614
|
-
|
|
2615
|
-
var getExpectedMediaFrameUncorrected = ({
|
|
2616
|
-
frame,
|
|
2617
|
-
playbackRate,
|
|
2618
|
-
startFrom
|
|
2619
|
-
}) => {
|
|
2620
|
-
return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
2588
|
+
return null;
|
|
2621
2589
|
};
|
|
2622
|
-
var
|
|
2623
|
-
|
|
2624
|
-
|
|
2590
|
+
var parseScaleValue = (value) => {
|
|
2591
|
+
return parseValidScaleValue(value) ?? defaultScaleValue;
|
|
2592
|
+
};
|
|
2593
|
+
var serializeScaleValue = ([x, y, z]) => {
|
|
2594
|
+
const normalizedX = normalizeNumber(x);
|
|
2595
|
+
const normalizedY = normalizeNumber(y);
|
|
2596
|
+
const normalizedZ = normalizeNumber(z);
|
|
2597
|
+
if (normalizedX === normalizedY && normalizedZ === 1) {
|
|
2598
|
+
return normalizedX;
|
|
2625
2599
|
}
|
|
2626
|
-
if (
|
|
2627
|
-
return
|
|
2600
|
+
if (normalizedZ === 1) {
|
|
2601
|
+
return \`\${normalizedX} \${normalizedY}\`;
|
|
2628
2602
|
}
|
|
2629
|
-
return
|
|
2603
|
+
return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
|
|
2630
2604
|
};
|
|
2631
|
-
var
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
currentTime,
|
|
2635
|
-
toneMapped
|
|
2605
|
+
var validateSelectedFrames = ({
|
|
2606
|
+
frames,
|
|
2607
|
+
durationInFrames
|
|
2636
2608
|
}) => {
|
|
2637
|
-
|
|
2609
|
+
if (!Array.isArray(frames)) {
|
|
2610
|
+
throw new TypeError("The \`frames\` option must be an array of frame numbers.");
|
|
2611
|
+
}
|
|
2612
|
+
if (frames.length === 0) {
|
|
2613
|
+
throw new TypeError("The \`frames\` option must contain at least one frame.");
|
|
2614
|
+
}
|
|
2615
|
+
for (const frame of frames) {
|
|
2616
|
+
if (typeof frame !== "number") {
|
|
2617
|
+
throw new TypeError(\`The \\\`frames\\\` option must contain only numbers, but got \${typeof frame}.\`);
|
|
2618
|
+
}
|
|
2619
|
+
if (!Number.isFinite(frame)) {
|
|
2620
|
+
throw new TypeError(\`The \\\`frames\\\` option must contain only finite numbers, but got \${frame}.\`);
|
|
2621
|
+
}
|
|
2622
|
+
if (!Number.isInteger(frame)) {
|
|
2623
|
+
throw new TypeError(\`The \\\`frames\\\` option must contain only integers, but got \${frame}.\`);
|
|
2624
|
+
}
|
|
2625
|
+
if (frame < 0) {
|
|
2626
|
+
throw new TypeError(\`The \\\`frames\\\` option must contain only non-negative numbers, but got \${frame}.\`);
|
|
2627
|
+
}
|
|
2628
|
+
if (durationInFrames !== null && frame >= durationInFrames) {
|
|
2629
|
+
throw new RangeError(\`Frame \${frame} is out of range, must be between 0 and \${durationInFrames - 1}.\`);
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
const uniqueFrames = new Set(frames);
|
|
2633
|
+
if (uniqueFrames.size !== frames.length) {
|
|
2634
|
+
throw new TypeError("The \`frames\` option must not contain duplicate frames.");
|
|
2635
|
+
}
|
|
2636
|
+
return [...frames].sort((a, b) => a - b);
|
|
2638
2637
|
};
|
|
2639
|
-
var
|
|
2638
|
+
var NoReactInternals2 = {
|
|
2640
2639
|
validatePreferredEffectBackend,
|
|
2641
2640
|
DEFAULT_PREMOUNT_IN_SECONDS,
|
|
2642
2641
|
DEFAULT_STUDIO_PREMOUNT_IN_SECONDS,
|
|
@@ -2686,7 +2685,7 @@ var noop = () => {
|
|
|
2686
2685
|
return;
|
|
2687
2686
|
};
|
|
2688
2687
|
try {
|
|
2689
|
-
const serializedInputProps =
|
|
2688
|
+
const serializedInputProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
2690
2689
|
data: config.inputProps,
|
|
2691
2690
|
indent: undefined,
|
|
2692
2691
|
staticBase: null
|
|
@@ -2731,653 +2730,717 @@ try {
|
|
|
2731
2730
|
mediaCacheSizeInBytes: config.mediaCacheSizeInBytes,
|
|
2732
2731
|
preferredEffectBackend: config.preferredEffectBackend,
|
|
2733
2732
|
offthreadVideoCacheSizeInBytes: config.offthreadVideoCacheSizeInBytes,
|
|
2734
|
-
offthreadVideoThreads: config.offthreadVideoThreads
|
|
2735
|
-
});
|
|
2736
|
-
const serializedResolvedProps =
|
|
2737
|
-
data: composition.props,
|
|
2738
|
-
indent: undefined,
|
|
2739
|
-
staticBase: null
|
|
2740
|
-
}).serializedString;
|
|
2741
|
-
const { contentType } = await RenderInternals.internalRenderStill({
|
|
2742
|
-
output: config.output,
|
|
2743
|
-
composition,
|
|
2744
|
-
serializedInputPropsWithCustomSchema: serializedInputProps,
|
|
2745
|
-
serializedResolvedPropsWithCustomSchema: serializedResolvedProps,
|
|
2746
|
-
serveUrl: config.serveUrl,
|
|
2747
|
-
frame: config.frame,
|
|
2748
|
-
imageFormat: config.imageFormat,
|
|
2749
|
-
jpegQuality: config.jpegQuality,
|
|
2750
|
-
envVariables: config.envVariables,
|
|
2751
|
-
overwrite: true,
|
|
2752
|
-
browserExecutable: config.browserExecutable,
|
|
2753
|
-
chromiumOptions: config.chromiumOptions,
|
|
2754
|
-
scale: config.scale,
|
|
2755
|
-
logLevel: config.logLevel,
|
|
2756
|
-
timeoutInMilliseconds: config.timeoutInMilliseconds,
|
|
2757
|
-
binariesDirectory: config.binariesDirectory,
|
|
2758
|
-
chromeMode: config.chromeMode,
|
|
2759
|
-
offthreadVideoCacheSizeInBytes: config.offthreadVideoCacheSizeInBytes,
|
|
2760
|
-
mediaCacheSizeInBytes: config.mediaCacheSizeInBytes,
|
|
2761
|
-
preferredEffectBackend: config.preferredEffectBackend,
|
|
2762
|
-
offthreadVideoThreads: config.offthreadVideoThreads,
|
|
2763
|
-
licenseKey: config.licenseKey,
|
|
2764
|
-
isProduction: config.isProduction,
|
|
2765
|
-
puppeteerInstance: browser,
|
|
2766
|
-
onBrowserLog: null,
|
|
2767
|
-
onDownload: null,
|
|
2768
|
-
cancelSignal: null,
|
|
2769
|
-
indent: false,
|
|
2770
|
-
server: undefined,
|
|
2771
|
-
port: null,
|
|
2772
|
-
onArtifact: null,
|
|
2773
|
-
onLog: RenderInternals.defaultOnLog,
|
|
2774
|
-
onBrowserDownload: () => ({
|
|
2775
|
-
version: null,
|
|
2776
|
-
onProgress: noop
|
|
2777
|
-
})
|
|
2778
|
-
});
|
|
2779
|
-
console.log(JSON.stringify({ type: "render-complete" }));
|
|
2780
|
-
await browser.close({ silent: false });
|
|
2781
|
-
const { size } = statSync(config.output ?? "/tmp/still.png");
|
|
2782
|
-
console.log(JSON.stringify({ type: "done", size, contentType }));
|
|
2783
|
-
} catch (err) {
|
|
2784
|
-
console.error(err.message);
|
|
2785
|
-
process.exit(1);
|
|
2786
|
-
}
|
|
2787
|
-
`;
|
|
2788
|
-
|
|
2789
|
-
// script-embed:render-video-script
|
|
2790
|
-
var script2 = `// src/scripts/render-video.ts
|
|
2791
|
-
import { randomUUID } from "crypto";
|
|
2792
|
-
import { stat, readFile, rename, writeFile } from "fs/promises";
|
|
2793
|
-
import { RenderInternals } from "@remotion/renderer";
|
|
2794
|
-
import { put } from "@vercel/blob";
|
|
2795
|
-
|
|
2796
|
-
// ../core/dist/esm/no-react.mjs
|
|
2797
|
-
var validatePreferredEffectBackend = (value) => {
|
|
2798
|
-
if (value !== "auto" && value !== "webgpu" && value !== "webgl2" && value !== "2d") {
|
|
2799
|
-
throw new TypeError(\`preferredEffectBackend must be "auto", "webgpu", "webgl2" or "2d", got \${String(value)}\`);
|
|
2800
|
-
}
|
|
2801
|
-
return value;
|
|
2802
|
-
};
|
|
2803
|
-
var evaluateSourceNumericValue = (expression, config) => {
|
|
2804
|
-
if (typeof expression === "number") {
|
|
2805
|
-
return expression;
|
|
2806
|
-
}
|
|
2807
|
-
if (expression.type === "literal") {
|
|
2808
|
-
return expression.value;
|
|
2809
|
-
}
|
|
2810
|
-
if (expression.type === "binary") {
|
|
2811
|
-
const left = evaluateSourceNumericValue(expression.left, config);
|
|
2812
|
-
const right = evaluateSourceNumericValue(expression.right, config);
|
|
2813
|
-
switch (expression.operator) {
|
|
2814
|
-
case "+":
|
|
2815
|
-
return left + right;
|
|
2816
|
-
case "-":
|
|
2817
|
-
return left - right;
|
|
2818
|
-
case "*":
|
|
2819
|
-
return left * right;
|
|
2820
|
-
case "/":
|
|
2821
|
-
return left / right;
|
|
2822
|
-
default:
|
|
2823
|
-
throw new Error("Unknown source expression operator");
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
const value = expression.binding.type === "constant" ? expression.binding.value : config?.[expression.binding.field] ?? NaN;
|
|
2827
|
-
if (expression.type === "video-config-multiplication") {
|
|
2828
|
-
return value * expression.multiplier;
|
|
2829
|
-
}
|
|
2830
|
-
if (expression.type === "video-config-subtraction") {
|
|
2831
|
-
return value - expression.subtrahend;
|
|
2832
|
-
}
|
|
2833
|
-
return value;
|
|
2834
|
-
};
|
|
2835
|
-
var evaluatedProps = new WeakMap;
|
|
2836
|
-
var evaluateSourcePropStatuses = (props, config) => {
|
|
2837
|
-
const configKey = config === null ? "" : \`\${config.durationInFrames}:\${config.fps}:\${config.width}:\${config.height}\`;
|
|
2838
|
-
const cached = evaluatedProps.get(props) ?? new Map;
|
|
2839
|
-
const existing = cached.get(configKey);
|
|
2840
|
-
if (existing)
|
|
2841
|
-
return existing;
|
|
2842
|
-
const result = Object.fromEntries(Object.entries(props).map(([key, status]) => {
|
|
2843
|
-
if (status.status === "computed") {
|
|
2844
|
-
return [key, status];
|
|
2845
|
-
}
|
|
2846
|
-
const adjustment = status.keyframeDisplayOffsetAdjustment === null ? null : evaluateSourceNumericValue(status.keyframeDisplayOffsetAdjustment, config);
|
|
2847
|
-
const rate = evaluateSourceNumericValue(status.keyframePlaybackRateAdjustment ?? 1, config);
|
|
2848
|
-
if (adjustment !== null && !Number.isFinite(adjustment) || !Number.isFinite(rate) || rate <= 0) {
|
|
2849
|
-
return [key, { status: "computed" }];
|
|
2850
|
-
}
|
|
2851
|
-
const timing = {
|
|
2852
|
-
keyframeDisplayOffsetAdjustment: adjustment,
|
|
2853
|
-
...status.keyframePlaybackRateAdjustment === undefined ? {} : { keyframePlaybackRateAdjustment: rate }
|
|
2854
|
-
};
|
|
2855
|
-
if (status.status === "static") {
|
|
2856
|
-
const value = status.numericExpression === undefined ? status.codeValue : evaluateSourceNumericValue(status.numericExpression, config);
|
|
2857
|
-
return [
|
|
2858
|
-
key,
|
|
2859
|
-
status.numericExpression !== undefined && !Number.isFinite(value) ? { status: "computed" } : { ...status, ...timing, codeValue: value }
|
|
2860
|
-
];
|
|
2861
|
-
}
|
|
2862
|
-
const keyframes = status.keyframes.map((keyframe) => ({
|
|
2863
|
-
...keyframe,
|
|
2864
|
-
frame: evaluateSourceNumericValue(keyframe.frame, config)
|
|
2865
|
-
}));
|
|
2866
|
-
if (keyframes.some((keyframe, index) => !Number.isFinite(keyframe.frame) || index > 0 && keyframe.frame <= keyframes[index - 1].frame)) {
|
|
2867
|
-
return [key, { status: "computed" }];
|
|
2868
|
-
}
|
|
2869
|
-
return [key, { ...status, ...timing, keyframes }];
|
|
2870
|
-
}));
|
|
2871
|
-
cached.set(configKey, result);
|
|
2872
|
-
if (cached.size > 8)
|
|
2873
|
-
cached.delete(cached.keys().next().value);
|
|
2874
|
-
evaluatedProps.set(props, cached);
|
|
2875
|
-
return result;
|
|
2876
|
-
};
|
|
2877
|
-
var DEFAULT_SEQUENCE_ACTIVITY_LIMIT = Infinity;
|
|
2878
|
-
var NEWTON_ITERATIONS = 4;
|
|
2879
|
-
var NEWTON_MIN_SLOPE = 0.001;
|
|
2880
|
-
var SUBDIVISION_PRECISION = 0.0000001;
|
|
2881
|
-
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
2882
|
-
var kSplineTableSize = 11;
|
|
2883
|
-
var kSampleStepSize = 1 / (kSplineTableSize - 1);
|
|
2884
|
-
var float32ArraySupported = typeof Float32Array === "function";
|
|
2885
|
-
function a(aA1, aA2) {
|
|
2886
|
-
return 1 - 3 * aA2 + 3 * aA1;
|
|
2887
|
-
}
|
|
2888
|
-
function b(aA1, aA2) {
|
|
2889
|
-
return 3 * aA2 - 6 * aA1;
|
|
2890
|
-
}
|
|
2891
|
-
function c(aA1) {
|
|
2892
|
-
return 3 * aA1;
|
|
2893
|
-
}
|
|
2894
|
-
function calcBezier(aT, aA1, aA2) {
|
|
2895
|
-
return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
|
|
2896
|
-
}
|
|
2897
|
-
function getSlope(aT, aA1, aA2) {
|
|
2898
|
-
return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
|
|
2899
|
-
}
|
|
2900
|
-
function binarySubdivide({
|
|
2901
|
-
aX,
|
|
2902
|
-
_aA,
|
|
2903
|
-
_aB,
|
|
2904
|
-
mX1,
|
|
2905
|
-
mX2
|
|
2906
|
-
}) {
|
|
2907
|
-
let currentX;
|
|
2908
|
-
let currentT;
|
|
2909
|
-
let i = 0;
|
|
2910
|
-
let aA = _aA;
|
|
2911
|
-
let aB = _aB;
|
|
2912
|
-
do {
|
|
2913
|
-
currentT = aA + (aB - aA) / 2;
|
|
2914
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
2915
|
-
if (currentX > 0) {
|
|
2916
|
-
aB = currentT;
|
|
2917
|
-
} else {
|
|
2918
|
-
aA = currentT;
|
|
2919
|
-
}
|
|
2920
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
2921
|
-
return currentT;
|
|
2733
|
+
offthreadVideoThreads: config.offthreadVideoThreads
|
|
2734
|
+
});
|
|
2735
|
+
const serializedResolvedProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
2736
|
+
data: composition.props,
|
|
2737
|
+
indent: undefined,
|
|
2738
|
+
staticBase: null
|
|
2739
|
+
}).serializedString;
|
|
2740
|
+
const { contentType } = await RenderInternals.internalRenderStill({
|
|
2741
|
+
output: config.output,
|
|
2742
|
+
composition,
|
|
2743
|
+
serializedInputPropsWithCustomSchema: serializedInputProps,
|
|
2744
|
+
serializedResolvedPropsWithCustomSchema: serializedResolvedProps,
|
|
2745
|
+
serveUrl: config.serveUrl,
|
|
2746
|
+
frame: config.frame,
|
|
2747
|
+
imageFormat: config.imageFormat,
|
|
2748
|
+
jpegQuality: config.jpegQuality,
|
|
2749
|
+
envVariables: config.envVariables,
|
|
2750
|
+
overwrite: true,
|
|
2751
|
+
browserExecutable: config.browserExecutable,
|
|
2752
|
+
chromiumOptions: config.chromiumOptions,
|
|
2753
|
+
scale: config.scale,
|
|
2754
|
+
logLevel: config.logLevel,
|
|
2755
|
+
timeoutInMilliseconds: config.timeoutInMilliseconds,
|
|
2756
|
+
binariesDirectory: config.binariesDirectory,
|
|
2757
|
+
chromeMode: config.chromeMode,
|
|
2758
|
+
offthreadVideoCacheSizeInBytes: config.offthreadVideoCacheSizeInBytes,
|
|
2759
|
+
mediaCacheSizeInBytes: config.mediaCacheSizeInBytes,
|
|
2760
|
+
preferredEffectBackend: config.preferredEffectBackend,
|
|
2761
|
+
offthreadVideoThreads: config.offthreadVideoThreads,
|
|
2762
|
+
licenseKey: config.licenseKey,
|
|
2763
|
+
isProduction: config.isProduction,
|
|
2764
|
+
puppeteerInstance: browser,
|
|
2765
|
+
onBrowserLog: null,
|
|
2766
|
+
onDownload: null,
|
|
2767
|
+
cancelSignal: null,
|
|
2768
|
+
indent: false,
|
|
2769
|
+
server: undefined,
|
|
2770
|
+
port: null,
|
|
2771
|
+
onArtifact: null,
|
|
2772
|
+
onLog: RenderInternals.defaultOnLog,
|
|
2773
|
+
onBrowserDownload: () => ({
|
|
2774
|
+
version: null,
|
|
2775
|
+
onProgress: noop
|
|
2776
|
+
})
|
|
2777
|
+
});
|
|
2778
|
+
console.log(JSON.stringify({ type: "render-complete" }));
|
|
2779
|
+
await browser.close({ silent: false });
|
|
2780
|
+
const { size } = statSync(config.output ?? "/tmp/still.png");
|
|
2781
|
+
console.log(JSON.stringify({ type: "done", size, contentType }));
|
|
2782
|
+
} catch (err) {
|
|
2783
|
+
console.error(err.message);
|
|
2784
|
+
process.exit(1);
|
|
2922
2785
|
}
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2786
|
+
`;
|
|
2787
|
+
|
|
2788
|
+
// script-embed:render-video-script
|
|
2789
|
+
var script2 = `// src/scripts/render-video.ts
|
|
2790
|
+
import { randomUUID } from "crypto";
|
|
2791
|
+
import { stat, readFile, rename, writeFile } from "fs/promises";
|
|
2792
|
+
import { RenderInternals } from "@remotion/renderer";
|
|
2793
|
+
import { put } from "@vercel/blob";
|
|
2794
|
+
|
|
2795
|
+
// ../core/dist/esm/chunk-m38ydj0s.mjs
|
|
2796
|
+
function truthy(value) {
|
|
2797
|
+
return Boolean(value);
|
|
2934
2798
|
}
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2799
|
+
var DATE_TOKEN = "remotion-date:";
|
|
2800
|
+
var FILE_TOKEN = "remotion-file:";
|
|
2801
|
+
var serializeJSONWithSpecialTypes = ({
|
|
2802
|
+
data,
|
|
2803
|
+
indent,
|
|
2804
|
+
staticBase
|
|
2805
|
+
}) => {
|
|
2806
|
+
let customDateUsed = false;
|
|
2807
|
+
let customFileUsed = false;
|
|
2808
|
+
let mapUsed = false;
|
|
2809
|
+
let setUsed = false;
|
|
2810
|
+
try {
|
|
2811
|
+
const serializedString = JSON.stringify(data, function(key, value) {
|
|
2812
|
+
const item = this[key];
|
|
2813
|
+
if (item instanceof Date) {
|
|
2814
|
+
customDateUsed = true;
|
|
2815
|
+
return \`\${DATE_TOKEN}\${item.toISOString()}\`;
|
|
2816
|
+
}
|
|
2817
|
+
if (item instanceof Map) {
|
|
2818
|
+
mapUsed = true;
|
|
2819
|
+
return value;
|
|
2820
|
+
}
|
|
2821
|
+
if (item instanceof Set) {
|
|
2822
|
+
setUsed = true;
|
|
2823
|
+
return value;
|
|
2824
|
+
}
|
|
2825
|
+
if (typeof item === "string" && staticBase !== null && staticBase !== "" && item.startsWith(staticBase)) {
|
|
2826
|
+
customFileUsed = true;
|
|
2827
|
+
return \`\${FILE_TOKEN}\${item.replace(staticBase + "/", "")}\`;
|
|
2828
|
+
}
|
|
2829
|
+
return value;
|
|
2830
|
+
}, indent);
|
|
2831
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
2832
|
+
} catch (err) {
|
|
2833
|
+
throw new Error("Could not serialize the passed input props to JSON: " + err.message);
|
|
2944
2834
|
}
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
const initialSlope = getSlope(guessForT, mX1, mX2);
|
|
2956
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
2957
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
2958
|
-
}
|
|
2959
|
-
if (initialSlope === 0) {
|
|
2960
|
-
return guessForT;
|
|
2961
|
-
}
|
|
2962
|
-
return binarySubdivide({
|
|
2963
|
-
aX,
|
|
2964
|
-
_aA: intervalStart,
|
|
2965
|
-
_aB: intervalStart + kSampleStepSize,
|
|
2966
|
-
mX1,
|
|
2967
|
-
mX2
|
|
2968
|
-
});
|
|
2835
|
+
};
|
|
2836
|
+
var resolveFileTokenToUrl = (value) => {
|
|
2837
|
+
const encodedName = value.replace(FILE_TOKEN, "");
|
|
2838
|
+
let name = encodedName;
|
|
2839
|
+
try {
|
|
2840
|
+
name = encodedName.split("/").map(decodeURIComponent).join("/");
|
|
2841
|
+
} catch {}
|
|
2842
|
+
const matchingStaticFile = window.remotion_staticFiles?.find((file) => file.name === name);
|
|
2843
|
+
if (matchingStaticFile) {
|
|
2844
|
+
return matchingStaticFile.src;
|
|
2969
2845
|
}
|
|
2970
|
-
return
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
return 0;
|
|
2846
|
+
return \`\${window.remotion_staticBase}/\${encodedName}\`;
|
|
2847
|
+
};
|
|
2848
|
+
var deserializeJSONWithSpecialTypes = (data) => {
|
|
2849
|
+
return JSON.parse(data, (_, value) => {
|
|
2850
|
+
if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
|
|
2851
|
+
return new Date(value.replace(DATE_TOKEN, ""));
|
|
2977
2852
|
}
|
|
2978
|
-
if (
|
|
2979
|
-
return
|
|
2853
|
+
if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
|
|
2854
|
+
return resolveFileTokenToUrl(value);
|
|
2980
2855
|
}
|
|
2981
|
-
return
|
|
2982
|
-
};
|
|
2983
|
-
}
|
|
2984
|
-
var validateFrame = ({
|
|
2985
|
-
allowFloats,
|
|
2986
|
-
durationInFrames,
|
|
2987
|
-
frame
|
|
2988
|
-
}) => {
|
|
2989
|
-
if (typeof frame === "undefined") {
|
|
2990
|
-
throw new TypeError(\`Argument missing for parameter "frame"\`);
|
|
2991
|
-
}
|
|
2992
|
-
if (typeof frame !== "number") {
|
|
2993
|
-
throw new TypeError(\`Argument passed for "frame" is not a number: \${frame}\`);
|
|
2994
|
-
}
|
|
2995
|
-
if (!Number.isFinite(frame)) {
|
|
2996
|
-
throw new RangeError(\`Frame \${frame} is not finite\`);
|
|
2997
|
-
}
|
|
2998
|
-
if (frame % 1 !== 0 && !allowFloats) {
|
|
2999
|
-
throw new RangeError(\`Argument for frame must be an integer, but got \${frame}\`);
|
|
3000
|
-
}
|
|
3001
|
-
if (frame < 0 && frame < -durationInFrames) {
|
|
3002
|
-
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the lowest frame that can be rendered is \${-durationInFrames}\`);
|
|
3003
|
-
}
|
|
3004
|
-
if (frame > durationInFrames - 1) {
|
|
3005
|
-
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the highest frame that can be rendered is \${durationInFrames - 1}\`);
|
|
3006
|
-
}
|
|
2856
|
+
return value;
|
|
2857
|
+
});
|
|
3007
2858
|
};
|
|
3008
|
-
function
|
|
3009
|
-
if (typeof
|
|
3010
|
-
throw new Error(\`"
|
|
2859
|
+
function validateDimension(amount, nameOfProp, location) {
|
|
2860
|
+
if (typeof amount !== "number") {
|
|
2861
|
+
throw new Error(\`The "\${nameOfProp}" prop \${location} must be a number, but you passed a value of type \${typeof amount}\`);
|
|
3011
2862
|
}
|
|
3012
|
-
if (
|
|
3013
|
-
throw new
|
|
2863
|
+
if (isNaN(amount)) {
|
|
2864
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must not be NaN, but is NaN.\`);
|
|
3014
2865
|
}
|
|
3015
|
-
if (
|
|
3016
|
-
throw new
|
|
2866
|
+
if (!Number.isFinite(amount)) {
|
|
2867
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
3017
2868
|
}
|
|
3018
|
-
if (
|
|
3019
|
-
throw new TypeError(\`"
|
|
2869
|
+
if (amount % 1 !== 0) {
|
|
2870
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
3020
2871
|
}
|
|
3021
|
-
if (
|
|
3022
|
-
throw new TypeError(\`The
|
|
2872
|
+
if (amount <= 0) {
|
|
2873
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be positive, but got \${amount}.\`);
|
|
3023
2874
|
}
|
|
3024
2875
|
}
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
if (typeof dur !== "number") {
|
|
3030
|
-
throw new TypeError(\`A "duration" of a spring must be a "number" but is "\${typeof dur}"\`);
|
|
3031
|
-
}
|
|
3032
|
-
if (Number.isNaN(dur)) {
|
|
3033
|
-
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
3034
|
-
}
|
|
3035
|
-
if (!Number.isFinite(dur)) {
|
|
3036
|
-
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
2876
|
+
function validateDurationInFrames(durationInFrames, options) {
|
|
2877
|
+
const { allowFloats, component } = options;
|
|
2878
|
+
if (typeof durationInFrames === "undefined") {
|
|
2879
|
+
throw new Error(\`The "durationInFrames" prop \${component} is missing.\`);
|
|
3037
2880
|
}
|
|
3038
|
-
if (
|
|
3039
|
-
throw new
|
|
2881
|
+
if (typeof durationInFrames !== "number") {
|
|
2882
|
+
throw new Error(\`The "durationInFrames" prop \${component} must be a number, but you passed a value of type \${typeof durationInFrames}\`);
|
|
3040
2883
|
}
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
damping: 10,
|
|
3044
|
-
mass: 1,
|
|
3045
|
-
stiffness: 100,
|
|
3046
|
-
overshootClamping: false
|
|
3047
|
-
};
|
|
3048
|
-
var advanceCache = {};
|
|
3049
|
-
function advance({
|
|
3050
|
-
animation,
|
|
3051
|
-
now,
|
|
3052
|
-
config
|
|
3053
|
-
}) {
|
|
3054
|
-
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
3055
|
-
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
3056
|
-
if (config.damping <= 0) {
|
|
3057
|
-
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
2884
|
+
if (durationInFrames <= 0) {
|
|
2885
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be positive, but got \${durationInFrames}.\`);
|
|
3058
2886
|
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
lastTimestamp,
|
|
3065
|
-
current,
|
|
3066
|
-
velocity,
|
|
3067
|
-
c,
|
|
3068
|
-
m,
|
|
3069
|
-
k,
|
|
3070
|
-
now
|
|
3071
|
-
].join("-");
|
|
3072
|
-
if (advanceCache[cacheKey]) {
|
|
3073
|
-
return advanceCache[cacheKey];
|
|
2887
|
+
if (!Number.isFinite(durationInFrames)) {
|
|
2888
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be finite, but got \${durationInFrames}.\`);
|
|
2889
|
+
}
|
|
2890
|
+
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
2891
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be an integer, but got \${durationInFrames}.\`);
|
|
3074
2892
|
}
|
|
3075
|
-
const v0 = -velocity;
|
|
3076
|
-
const x0 = toValue - current;
|
|
3077
|
-
const zeta = c / (2 * Math.sqrt(k * m));
|
|
3078
|
-
const omega0 = Math.sqrt(k / m);
|
|
3079
|
-
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
3080
|
-
const t = deltaTime / 1000;
|
|
3081
|
-
const sin1 = Math.sin(omega1 * t);
|
|
3082
|
-
const cos1 = Math.cos(omega1 * t);
|
|
3083
|
-
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
3084
|
-
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
3085
|
-
const underDampedPosition = toValue - underDampedFrag1;
|
|
3086
|
-
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
3087
|
-
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
3088
|
-
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
3089
|
-
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
3090
|
-
const animationNode = {
|
|
3091
|
-
toValue,
|
|
3092
|
-
prevPosition: current,
|
|
3093
|
-
lastTimestamp: now,
|
|
3094
|
-
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
3095
|
-
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
3096
|
-
};
|
|
3097
|
-
advanceCache[cacheKey] = animationNode;
|
|
3098
|
-
return animationNode;
|
|
3099
2893
|
}
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
fps,
|
|
3104
|
-
config = {}
|
|
3105
|
-
}) {
|
|
3106
|
-
const from = 0;
|
|
3107
|
-
const to = 1;
|
|
3108
|
-
const resolvedConfig = {
|
|
3109
|
-
damping: config.damping ?? defaultSpringConfig.damping,
|
|
3110
|
-
mass: config.mass ?? defaultSpringConfig.mass,
|
|
3111
|
-
stiffness: config.stiffness ?? defaultSpringConfig.stiffness,
|
|
3112
|
-
overshootClamping: config.overshootClamping ?? defaultSpringConfig.overshootClamping
|
|
3113
|
-
};
|
|
3114
|
-
const configKey = [
|
|
3115
|
-
fps,
|
|
3116
|
-
resolvedConfig.damping,
|
|
3117
|
-
resolvedConfig.mass,
|
|
3118
|
-
resolvedConfig.overshootClamping,
|
|
3119
|
-
resolvedConfig.stiffness
|
|
3120
|
-
].join("-");
|
|
3121
|
-
const cacheKey = \`\${frame}-\${configKey}\`;
|
|
3122
|
-
if (calculationCache[cacheKey]) {
|
|
3123
|
-
return calculationCache[cacheKey];
|
|
2894
|
+
function validateFps(fps, location, isGif) {
|
|
2895
|
+
if (typeof fps !== "number") {
|
|
2896
|
+
throw new Error(\`"fps" must be a number, but you passed a value of type \${typeof fps} \${location}\`);
|
|
3124
2897
|
}
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
const previousAnimation = previousFrame >= 0 ? calculationCache[\`\${previousFrame}-\${configKey}\`] : undefined;
|
|
3128
|
-
let animation = previousAnimation ?? {
|
|
3129
|
-
lastTimestamp: 0,
|
|
3130
|
-
current: from,
|
|
3131
|
-
toValue: to,
|
|
3132
|
-
velocity: 0,
|
|
3133
|
-
prevPosition: 0
|
|
3134
|
-
};
|
|
3135
|
-
const unevenRest = frameClamped % 1;
|
|
3136
|
-
const startFrame = previousAnimation ? previousFrame + 1 : 0;
|
|
3137
|
-
for (let f = startFrame;f <= Math.floor(frameClamped); f++) {
|
|
3138
|
-
const time = f / fps * 1000;
|
|
3139
|
-
animation = advance({
|
|
3140
|
-
animation,
|
|
3141
|
-
now: time,
|
|
3142
|
-
config: resolvedConfig
|
|
3143
|
-
});
|
|
2898
|
+
if (!Number.isFinite(fps)) {
|
|
2899
|
+
throw new Error(\`"fps" must be a finite, but you passed \${fps} \${location}\`);
|
|
3144
2900
|
}
|
|
3145
|
-
if (
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
2901
|
+
if (isNaN(fps)) {
|
|
2902
|
+
throw new Error(\`"fps" must not be NaN, but got \${fps} \${location}\`);
|
|
2903
|
+
}
|
|
2904
|
+
if (fps <= 0) {
|
|
2905
|
+
throw new TypeError(\`"fps" must be positive, but got \${fps} \${location}\`);
|
|
2906
|
+
}
|
|
2907
|
+
if (isGif && fps > 50) {
|
|
2908
|
+
throw new TypeError(\`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif\`);
|
|
3151
2909
|
}
|
|
3152
|
-
calculationCache[cacheKey] = animation;
|
|
3153
|
-
return animation;
|
|
3154
2910
|
}
|
|
3155
|
-
var
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
throw new TypeError(\`threshold must be a number, got \${threshold} of type \${typeof threshold}\`);
|
|
2911
|
+
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
2912
|
+
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
2913
|
+
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
2914
|
+
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
2915
|
+
var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
2916
|
+
if (!defaultProps) {
|
|
2917
|
+
return;
|
|
3163
2918
|
}
|
|
3164
|
-
if (
|
|
3165
|
-
|
|
2919
|
+
if (typeof defaultProps !== "object") {
|
|
2920
|
+
throw new Error(\`"\${name}" must be an object, but you passed a value of type \${typeof defaultProps}\`);
|
|
3166
2921
|
}
|
|
3167
|
-
if (
|
|
3168
|
-
|
|
2922
|
+
if (Array.isArray(defaultProps)) {
|
|
2923
|
+
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
3169
2924
|
}
|
|
3170
|
-
|
|
3171
|
-
|
|
2925
|
+
};
|
|
2926
|
+
var ENABLE_V5_BREAKING_CHANGES = false;
|
|
2927
|
+
var DEFAULT_PREMOUNT_IN_SECONDS = ENABLE_V5_BREAKING_CHANGES ? 2 : 0;
|
|
2928
|
+
var DEFAULT_STUDIO_PREMOUNT_IN_SECONDS = 2;
|
|
2929
|
+
var validateDefaultPremountInSeconds = (value) => {
|
|
2930
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
2931
|
+
throw new TypeError(\`defaultPremountInSeconds must be a finite, non-negative number, but got \${String(value)}.\`);
|
|
3172
2932
|
}
|
|
3173
|
-
|
|
3174
|
-
|
|
2933
|
+
};
|
|
2934
|
+
var DEFAULT_SEQUENCE_ACTIVITY_LIMIT = Infinity;
|
|
2935
|
+
var transformSchema = {
|
|
2936
|
+
"style.transformOrigin": {
|
|
2937
|
+
type: "transform-origin",
|
|
2938
|
+
step: 1,
|
|
2939
|
+
default: "50% 50%",
|
|
2940
|
+
description: "Origin"
|
|
2941
|
+
},
|
|
2942
|
+
"style.translate": {
|
|
2943
|
+
type: "translate",
|
|
2944
|
+
step: 1,
|
|
2945
|
+
default: "0px 0px",
|
|
2946
|
+
description: "Offset"
|
|
2947
|
+
},
|
|
2948
|
+
"style.scale": {
|
|
2949
|
+
type: "scale",
|
|
2950
|
+
max: 100,
|
|
2951
|
+
step: 0.01,
|
|
2952
|
+
default: 1,
|
|
2953
|
+
description: "Scale",
|
|
2954
|
+
defaultKeyframeOutput: "perceptual-scale"
|
|
2955
|
+
},
|
|
2956
|
+
"style.rotate": {
|
|
2957
|
+
type: "rotation-css",
|
|
2958
|
+
step: 1,
|
|
2959
|
+
default: "0deg",
|
|
2960
|
+
description: "Rotation"
|
|
2961
|
+
},
|
|
2962
|
+
"style.opacity": {
|
|
2963
|
+
type: "number",
|
|
2964
|
+
min: 0,
|
|
2965
|
+
max: 1,
|
|
2966
|
+
step: 0.01,
|
|
2967
|
+
default: 1,
|
|
2968
|
+
description: "Opacity",
|
|
2969
|
+
hiddenFromList: false
|
|
3175
2970
|
}
|
|
3176
|
-
|
|
3177
|
-
|
|
2971
|
+
};
|
|
2972
|
+
var borderSchema = {
|
|
2973
|
+
"style.borderWidth": {
|
|
2974
|
+
type: "number",
|
|
2975
|
+
default: undefined,
|
|
2976
|
+
min: 0,
|
|
2977
|
+
step: 1,
|
|
2978
|
+
description: "Border width",
|
|
2979
|
+
hiddenFromList: false
|
|
2980
|
+
},
|
|
2981
|
+
"style.borderStyle": {
|
|
2982
|
+
type: "enum",
|
|
2983
|
+
default: "none",
|
|
2984
|
+
description: "Border style",
|
|
2985
|
+
variants: {
|
|
2986
|
+
none: {},
|
|
2987
|
+
hidden: {},
|
|
2988
|
+
solid: {},
|
|
2989
|
+
dashed: {},
|
|
2990
|
+
dotted: {},
|
|
2991
|
+
double: {},
|
|
2992
|
+
groove: {},
|
|
2993
|
+
ridge: {},
|
|
2994
|
+
inset: {},
|
|
2995
|
+
outset: {}
|
|
2996
|
+
}
|
|
2997
|
+
},
|
|
2998
|
+
"style.borderColor": {
|
|
2999
|
+
type: "color",
|
|
3000
|
+
default: undefined,
|
|
3001
|
+
description: "Border color"
|
|
3178
3002
|
}
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3003
|
+
};
|
|
3004
|
+
var borderRadiusSchema = {
|
|
3005
|
+
"style.borderRadius": {
|
|
3006
|
+
type: "number",
|
|
3007
|
+
default: 0,
|
|
3008
|
+
min: 0,
|
|
3009
|
+
step: 1,
|
|
3010
|
+
description: "Border radius",
|
|
3011
|
+
hiddenFromList: false,
|
|
3012
|
+
keyframable: true
|
|
3013
|
+
},
|
|
3014
|
+
"style.borderTopLeftRadius": {
|
|
3015
|
+
type: "number",
|
|
3016
|
+
default: 0,
|
|
3017
|
+
min: 0,
|
|
3018
|
+
step: 1,
|
|
3019
|
+
description: "Top left radius",
|
|
3020
|
+
hiddenFromList: false
|
|
3021
|
+
},
|
|
3022
|
+
"style.borderTopRightRadius": {
|
|
3023
|
+
type: "number",
|
|
3024
|
+
default: 0,
|
|
3025
|
+
min: 0,
|
|
3026
|
+
step: 1,
|
|
3027
|
+
description: "Top right radius",
|
|
3028
|
+
hiddenFromList: false
|
|
3029
|
+
},
|
|
3030
|
+
"style.borderBottomRightRadius": {
|
|
3031
|
+
type: "number",
|
|
3032
|
+
default: 0,
|
|
3033
|
+
min: 0,
|
|
3034
|
+
step: 1,
|
|
3035
|
+
description: "Bottom right radius",
|
|
3036
|
+
hiddenFromList: false
|
|
3037
|
+
},
|
|
3038
|
+
"style.borderBottomLeftRadius": {
|
|
3039
|
+
type: "number",
|
|
3040
|
+
default: 0,
|
|
3041
|
+
min: 0,
|
|
3042
|
+
step: 1,
|
|
3043
|
+
description: "Bottom left radius",
|
|
3044
|
+
hiddenFromList: false
|
|
3189
3045
|
}
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
frame,
|
|
3197
|
-
config
|
|
3198
|
-
});
|
|
3199
|
-
};
|
|
3200
|
-
let animation = calc();
|
|
3201
|
-
const calcDifference = () => {
|
|
3202
|
-
return Math.abs(animation.current - animation.toValue);
|
|
3203
|
-
};
|
|
3204
|
-
let difference = calcDifference();
|
|
3205
|
-
while (difference >= threshold) {
|
|
3206
|
-
frame++;
|
|
3207
|
-
animation = calc();
|
|
3208
|
-
difference = calcDifference();
|
|
3046
|
+
};
|
|
3047
|
+
var backgroundSchema = {
|
|
3048
|
+
"style.backgroundColor": {
|
|
3049
|
+
type: "color",
|
|
3050
|
+
default: "transparent",
|
|
3051
|
+
description: "Color"
|
|
3209
3052
|
}
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
i = 0;
|
|
3217
|
-
finishedFrame = frame + 1;
|
|
3218
|
-
}
|
|
3053
|
+
};
|
|
3054
|
+
var svgColorSchema = {
|
|
3055
|
+
color: {
|
|
3056
|
+
type: "color",
|
|
3057
|
+
default: undefined,
|
|
3058
|
+
description: "Current color"
|
|
3219
3059
|
}
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
validateFrame({
|
|
3236
|
-
frame: passedFrame,
|
|
3237
|
-
durationInFrames: Infinity,
|
|
3238
|
-
allowFloats: true
|
|
3239
|
-
});
|
|
3240
|
-
validateFps(fps, "to spring()", false);
|
|
3241
|
-
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
3242
|
-
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring({
|
|
3243
|
-
fps,
|
|
3244
|
-
config,
|
|
3245
|
-
threshold: durationRestThreshold
|
|
3246
|
-
}) : undefined;
|
|
3247
|
-
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
3248
|
-
get: () => naturalDuration
|
|
3249
|
-
} : {
|
|
3250
|
-
get: () => {
|
|
3251
|
-
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
3252
|
-
}
|
|
3253
|
-
};
|
|
3254
|
-
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
3255
|
-
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
3256
|
-
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
3257
|
-
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
3258
|
-
return to;
|
|
3060
|
+
};
|
|
3061
|
+
var svgStrokeSchema = {
|
|
3062
|
+
...svgColorSchema,
|
|
3063
|
+
stroke: {
|
|
3064
|
+
type: "color",
|
|
3065
|
+
default: "none",
|
|
3066
|
+
description: "Stroke"
|
|
3067
|
+
},
|
|
3068
|
+
strokeWidth: {
|
|
3069
|
+
type: "number",
|
|
3070
|
+
default: 1,
|
|
3071
|
+
description: "Stroke width",
|
|
3072
|
+
min: 0,
|
|
3073
|
+
step: 1,
|
|
3074
|
+
hiddenFromList: false
|
|
3259
3075
|
}
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
}
|
|
3269
|
-
var
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3076
|
+
};
|
|
3077
|
+
var svgPaintSchema = {
|
|
3078
|
+
fill: {
|
|
3079
|
+
type: "color",
|
|
3080
|
+
default: undefined,
|
|
3081
|
+
description: "Fill"
|
|
3082
|
+
},
|
|
3083
|
+
...svgStrokeSchema
|
|
3084
|
+
};
|
|
3085
|
+
var premountSchema = {
|
|
3086
|
+
premountFor: {
|
|
3087
|
+
type: "number",
|
|
3088
|
+
default: undefined,
|
|
3089
|
+
description: "Premount For",
|
|
3090
|
+
min: 0,
|
|
3091
|
+
step: 1,
|
|
3092
|
+
hiddenFromList: false,
|
|
3093
|
+
keyframable: false
|
|
3094
|
+
},
|
|
3095
|
+
postmountFor: {
|
|
3096
|
+
type: "number",
|
|
3097
|
+
default: 0,
|
|
3098
|
+
min: 0,
|
|
3099
|
+
step: 1,
|
|
3100
|
+
hiddenFromList: true,
|
|
3101
|
+
keyframable: false
|
|
3276
3102
|
}
|
|
3277
|
-
|
|
3278
|
-
|
|
3103
|
+
};
|
|
3104
|
+
var sequencePremountSchema = {
|
|
3105
|
+
...premountSchema
|
|
3106
|
+
};
|
|
3107
|
+
var cropSchema = {
|
|
3108
|
+
cropLeft: {
|
|
3109
|
+
type: "number",
|
|
3110
|
+
default: 0,
|
|
3111
|
+
description: "Crop left",
|
|
3112
|
+
min: 0,
|
|
3113
|
+
max: 1,
|
|
3114
|
+
step: 0.01,
|
|
3115
|
+
hiddenFromList: false,
|
|
3116
|
+
keyframable: true
|
|
3117
|
+
},
|
|
3118
|
+
cropRight: {
|
|
3119
|
+
type: "number",
|
|
3120
|
+
default: 0,
|
|
3121
|
+
description: "Crop right",
|
|
3122
|
+
min: 0,
|
|
3123
|
+
max: 1,
|
|
3124
|
+
step: 0.01,
|
|
3125
|
+
hiddenFromList: false,
|
|
3126
|
+
keyframable: true
|
|
3127
|
+
},
|
|
3128
|
+
cropTop: {
|
|
3129
|
+
type: "number",
|
|
3130
|
+
default: 0,
|
|
3131
|
+
description: "Crop top",
|
|
3132
|
+
min: 0,
|
|
3133
|
+
max: 1,
|
|
3134
|
+
step: 0.01,
|
|
3135
|
+
hiddenFromList: false,
|
|
3136
|
+
keyframable: true
|
|
3137
|
+
},
|
|
3138
|
+
cropBottom: {
|
|
3139
|
+
type: "number",
|
|
3140
|
+
default: 0,
|
|
3141
|
+
description: "Crop bottom",
|
|
3142
|
+
min: 0,
|
|
3143
|
+
max: 1,
|
|
3144
|
+
step: 0.01,
|
|
3145
|
+
hiddenFromList: false,
|
|
3146
|
+
keyframable: true
|
|
3279
3147
|
}
|
|
3280
|
-
|
|
3281
|
-
|
|
3148
|
+
};
|
|
3149
|
+
var sequenceCropSchema = cropSchema;
|
|
3150
|
+
var sequenceStyleSchema = {
|
|
3151
|
+
...sequenceCropSchema,
|
|
3152
|
+
...transformSchema,
|
|
3153
|
+
...backgroundSchema,
|
|
3154
|
+
...borderSchema,
|
|
3155
|
+
...borderRadiusSchema
|
|
3156
|
+
};
|
|
3157
|
+
var hiddenField = {
|
|
3158
|
+
type: "boolean",
|
|
3159
|
+
default: false,
|
|
3160
|
+
description: "Hidden"
|
|
3161
|
+
};
|
|
3162
|
+
var showInTimelineField = {
|
|
3163
|
+
type: "hidden"
|
|
3164
|
+
};
|
|
3165
|
+
var sequenceNameField = {
|
|
3166
|
+
type: "hidden"
|
|
3167
|
+
};
|
|
3168
|
+
var durationInFramesField = {
|
|
3169
|
+
type: "number",
|
|
3170
|
+
default: undefined,
|
|
3171
|
+
min: 1,
|
|
3172
|
+
step: 1,
|
|
3173
|
+
hiddenFromList: true
|
|
3174
|
+
};
|
|
3175
|
+
var fromField = {
|
|
3176
|
+
type: "number",
|
|
3177
|
+
default: 0,
|
|
3178
|
+
step: 1,
|
|
3179
|
+
hiddenFromList: true
|
|
3180
|
+
};
|
|
3181
|
+
var trimBeforeField = {
|
|
3182
|
+
type: "number",
|
|
3183
|
+
default: 0,
|
|
3184
|
+
min: 0,
|
|
3185
|
+
step: 1,
|
|
3186
|
+
hiddenFromList: true
|
|
3187
|
+
};
|
|
3188
|
+
var sequenceTimingSchema = {
|
|
3189
|
+
from: {
|
|
3190
|
+
...fromField,
|
|
3191
|
+
description: "From",
|
|
3192
|
+
hiddenFromList: false,
|
|
3193
|
+
keyframable: false
|
|
3194
|
+
},
|
|
3195
|
+
durationInFrames: {
|
|
3196
|
+
...durationInFramesField,
|
|
3197
|
+
description: "Duration",
|
|
3198
|
+
hiddenFromList: false,
|
|
3199
|
+
keyframable: false
|
|
3200
|
+
},
|
|
3201
|
+
trimBefore: {
|
|
3202
|
+
...trimBeforeField,
|
|
3203
|
+
description: "Trim before",
|
|
3204
|
+
hiddenFromList: false,
|
|
3205
|
+
keyframable: false
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
var freezeField = {
|
|
3209
|
+
type: "number",
|
|
3210
|
+
default: null,
|
|
3211
|
+
step: 1,
|
|
3212
|
+
hiddenFromList: true
|
|
3213
|
+
};
|
|
3214
|
+
var playbackRateField = {
|
|
3215
|
+
type: "number",
|
|
3216
|
+
default: 1,
|
|
3217
|
+
min: 0.01,
|
|
3218
|
+
step: 0.1,
|
|
3219
|
+
description: "Playback rate",
|
|
3220
|
+
hiddenFromList: false,
|
|
3221
|
+
keyframable: false
|
|
3222
|
+
};
|
|
3223
|
+
var baseSchema = {
|
|
3224
|
+
durationInFrames: durationInFramesField,
|
|
3225
|
+
from: fromField,
|
|
3226
|
+
trimBefore: trimBeforeField,
|
|
3227
|
+
playbackRate: playbackRateField,
|
|
3228
|
+
freeze: freezeField,
|
|
3229
|
+
hidden: hiddenField,
|
|
3230
|
+
name: sequenceNameField,
|
|
3231
|
+
showInTimeline: showInTimelineField
|
|
3232
|
+
};
|
|
3233
|
+
var sequenceSchema = {
|
|
3234
|
+
...baseSchema,
|
|
3235
|
+
layout: {
|
|
3236
|
+
type: "enum",
|
|
3237
|
+
default: "absolute-fill",
|
|
3238
|
+
description: "Layout",
|
|
3239
|
+
variants: {
|
|
3240
|
+
"absolute-fill": sequenceStyleSchema,
|
|
3241
|
+
none: {}
|
|
3242
|
+
}
|
|
3282
3243
|
}
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3244
|
+
};
|
|
3245
|
+
var baseSchemaWithoutFrom = {
|
|
3246
|
+
durationInFrames: durationInFramesField,
|
|
3247
|
+
trimBefore: trimBeforeField,
|
|
3248
|
+
playbackRate: playbackRateField,
|
|
3249
|
+
freeze: freezeField,
|
|
3250
|
+
hidden: hiddenField,
|
|
3251
|
+
name: sequenceNameField,
|
|
3252
|
+
showInTimeline: showInTimelineField
|
|
3253
|
+
};
|
|
3254
|
+
var sequenceSchemaWithoutFrom = {
|
|
3255
|
+
...baseSchemaWithoutFrom,
|
|
3256
|
+
layout: sequenceSchema.layout
|
|
3257
|
+
};
|
|
3258
|
+
var sequenceSchemaDefaultLayoutNone = {
|
|
3259
|
+
...sequenceSchema,
|
|
3260
|
+
layout: {
|
|
3261
|
+
...sequenceSchema.layout,
|
|
3262
|
+
default: "none"
|
|
3286
3263
|
}
|
|
3287
|
-
|
|
3288
|
-
|
|
3264
|
+
};
|
|
3265
|
+
var evaluateSourceNumericValue = (expression, config) => {
|
|
3266
|
+
if (typeof expression === "number") {
|
|
3267
|
+
return expression;
|
|
3289
3268
|
}
|
|
3290
|
-
|
|
3291
|
-
return
|
|
3269
|
+
if (expression.type === "literal") {
|
|
3270
|
+
return expression.value;
|
|
3292
3271
|
}
|
|
3293
|
-
|
|
3294
|
-
|
|
3272
|
+
if (expression.type === "binary") {
|
|
3273
|
+
const left = evaluateSourceNumericValue(expression.left, config);
|
|
3274
|
+
const right = evaluateSourceNumericValue(expression.right, config);
|
|
3275
|
+
switch (expression.operator) {
|
|
3276
|
+
case "+":
|
|
3277
|
+
return left + right;
|
|
3278
|
+
case "-":
|
|
3279
|
+
return left - right;
|
|
3280
|
+
case "*":
|
|
3281
|
+
return left * right;
|
|
3282
|
+
case "/":
|
|
3283
|
+
return left / right;
|
|
3284
|
+
default:
|
|
3285
|
+
throw new Error("Unknown source expression operator");
|
|
3286
|
+
}
|
|
3295
3287
|
}
|
|
3296
|
-
|
|
3297
|
-
|
|
3288
|
+
const value = expression.binding.type === "constant" ? expression.binding.value : config?.[expression.binding.field] ?? NaN;
|
|
3289
|
+
if (expression.type === "video-config-multiplication") {
|
|
3290
|
+
return value * expression.multiplier;
|
|
3298
3291
|
}
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
return 1 - Math.sqrt(1 - u * u);
|
|
3292
|
+
if (expression.type === "video-config-subtraction") {
|
|
3293
|
+
return value - expression.subtrahend;
|
|
3302
3294
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3295
|
+
return value;
|
|
3296
|
+
};
|
|
3297
|
+
var evaluatedProps = new WeakMap;
|
|
3298
|
+
var evaluateSourcePropStatuses = (props, config) => {
|
|
3299
|
+
const configKey = config === null ? "" : \`\${config.durationInFrames}:\${config.fps}:\${config.width}:\${config.height}\`;
|
|
3300
|
+
const cached = evaluatedProps.get(props) ?? new Map;
|
|
3301
|
+
const existing = cached.get(configKey);
|
|
3302
|
+
if (existing)
|
|
3303
|
+
return existing;
|
|
3304
|
+
const result = Object.fromEntries(Object.entries(props).map(([key, status]) => {
|
|
3305
|
+
if (status.status === "computed") {
|
|
3306
|
+
return [key, status];
|
|
3307
|
+
}
|
|
3308
|
+
const adjustment = status.keyframeDisplayOffsetAdjustment === null ? null : evaluateSourceNumericValue(status.keyframeDisplayOffsetAdjustment, config);
|
|
3309
|
+
const rate = evaluateSourceNumericValue(status.keyframePlaybackRateAdjustment ?? 1, config);
|
|
3310
|
+
if (adjustment !== null && !Number.isFinite(adjustment) || !Number.isFinite(rate) || rate <= 0) {
|
|
3311
|
+
return [key, { status: "computed" }];
|
|
3312
|
+
}
|
|
3313
|
+
const timing = {
|
|
3314
|
+
keyframeDisplayOffsetAdjustment: adjustment,
|
|
3315
|
+
...status.keyframePlaybackRateAdjustment === undefined ? {} : { keyframePlaybackRateAdjustment: rate }
|
|
3316
|
+
};
|
|
3317
|
+
if (status.status === "static") {
|
|
3318
|
+
const value = status.numericExpression === undefined ? status.codeValue : evaluateSourceNumericValue(status.numericExpression, config);
|
|
3319
|
+
return [
|
|
3320
|
+
key,
|
|
3321
|
+
status.numericExpression !== undefined && !Number.isFinite(value) ? { status: "computed" } : { ...status, ...timing, codeValue: value }
|
|
3322
|
+
];
|
|
3323
|
+
}
|
|
3324
|
+
const keyframes = status.keyframes.map((keyframe) => ({
|
|
3325
|
+
...keyframe,
|
|
3326
|
+
frame: evaluateSourceNumericValue(keyframe.frame, config)
|
|
3327
|
+
}));
|
|
3328
|
+
if (keyframes.some((keyframe, index) => !Number.isFinite(keyframe.frame) || index > 0 && keyframe.frame <= keyframes[index - 1].frame)) {
|
|
3329
|
+
return [key, { status: "computed" }];
|
|
3330
|
+
}
|
|
3331
|
+
return [key, { ...status, ...timing, keyframes }];
|
|
3332
|
+
}));
|
|
3333
|
+
cached.set(configKey, result);
|
|
3334
|
+
if (cached.size > 8)
|
|
3335
|
+
cached.delete(cached.keys().next().value);
|
|
3336
|
+
evaluatedProps.set(props, cached);
|
|
3337
|
+
return result;
|
|
3338
|
+
};
|
|
3339
|
+
var NEWTON_ITERATIONS = 4;
|
|
3340
|
+
var NEWTON_MIN_SLOPE = 0.001;
|
|
3341
|
+
var SUBDIVISION_PRECISION = 0.0000001;
|
|
3342
|
+
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
3343
|
+
var kSplineTableSize = 11;
|
|
3344
|
+
var kSampleStepSize = 1 / (kSplineTableSize - 1);
|
|
3345
|
+
var float32ArraySupported = typeof Float32Array === "function";
|
|
3346
|
+
function a(aA1, aA2) {
|
|
3347
|
+
return 1 - 3 * aA2 + 3 * aA1;
|
|
3348
|
+
}
|
|
3349
|
+
function b(aA1, aA2) {
|
|
3350
|
+
return 3 * aA2 - 6 * aA1;
|
|
3351
|
+
}
|
|
3352
|
+
function c(aA1) {
|
|
3353
|
+
return 3 * aA1;
|
|
3354
|
+
}
|
|
3355
|
+
function calcBezier(aT, aA1, aA2) {
|
|
3356
|
+
return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
|
|
3357
|
+
}
|
|
3358
|
+
function getSlope(aT, aA1, aA2) {
|
|
3359
|
+
return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
|
|
3360
|
+
}
|
|
3361
|
+
function binarySubdivide({
|
|
3362
|
+
aX,
|
|
3363
|
+
_aA,
|
|
3364
|
+
_aB,
|
|
3365
|
+
mX1,
|
|
3366
|
+
mX2
|
|
3367
|
+
}) {
|
|
3368
|
+
let currentX;
|
|
3369
|
+
let currentT;
|
|
3370
|
+
let i = 0;
|
|
3371
|
+
let aA = _aA;
|
|
3372
|
+
let aB = _aB;
|
|
3373
|
+
do {
|
|
3374
|
+
currentT = aA + (aB - aA) / 2;
|
|
3375
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
3376
|
+
if (currentX > 0) {
|
|
3377
|
+
aB = currentT;
|
|
3378
|
+
} else {
|
|
3379
|
+
aA = currentT;
|
|
3380
|
+
}
|
|
3381
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
3382
|
+
return currentT;
|
|
3383
|
+
}
|
|
3384
|
+
function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) {
|
|
3385
|
+
let aGuessT = _aGuessT;
|
|
3386
|
+
for (let i = 0;i < NEWTON_ITERATIONS; ++i) {
|
|
3387
|
+
const currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
3388
|
+
if (currentSlope === 0) {
|
|
3389
|
+
return aGuessT;
|
|
3390
|
+
}
|
|
3391
|
+
const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
3392
|
+
aGuessT -= currentX / currentSlope;
|
|
3305
3393
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3394
|
+
return aGuessT;
|
|
3395
|
+
}
|
|
3396
|
+
function bezier(mX1, mY1, mX2, mY2) {
|
|
3397
|
+
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
|
3398
|
+
throw new Error("bezier x values must be in [0, 1] range");
|
|
3309
3399
|
}
|
|
3310
|
-
|
|
3311
|
-
|
|
3400
|
+
const sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
|
3401
|
+
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
3402
|
+
for (let i = 0;i < kSplineTableSize; ++i) {
|
|
3403
|
+
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
3404
|
+
}
|
|
3312
3405
|
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
return spring({
|
|
3337
|
-
fps: springEasingDurationInFrames,
|
|
3338
|
-
frame: t * springEasingDurationInFrames,
|
|
3339
|
-
config,
|
|
3340
|
-
durationInFrames: springEasingDurationInFrames,
|
|
3341
|
-
durationRestThreshold
|
|
3342
|
-
});
|
|
3343
|
-
};
|
|
3344
|
-
return Object.assign(easing, {
|
|
3345
|
-
remotionShouldExtendRight: allowTail
|
|
3406
|
+
function getTForX(aX) {
|
|
3407
|
+
let intervalStart = 0;
|
|
3408
|
+
let currentSample = 1;
|
|
3409
|
+
const lastSample = kSplineTableSize - 1;
|
|
3410
|
+
for (;currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
3411
|
+
intervalStart += kSampleStepSize;
|
|
3412
|
+
}
|
|
3413
|
+
--currentSample;
|
|
3414
|
+
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
3415
|
+
const guessForT = intervalStart + dist * kSampleStepSize;
|
|
3416
|
+
const initialSlope = getSlope(guessForT, mX1, mX2);
|
|
3417
|
+
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
3418
|
+
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
3419
|
+
}
|
|
3420
|
+
if (initialSlope === 0) {
|
|
3421
|
+
return guessForT;
|
|
3422
|
+
}
|
|
3423
|
+
return binarySubdivide({
|
|
3424
|
+
aX,
|
|
3425
|
+
_aA: intervalStart,
|
|
3426
|
+
_aB: intervalStart + kSampleStepSize,
|
|
3427
|
+
mX1,
|
|
3428
|
+
mX2
|
|
3346
3429
|
});
|
|
3347
|
-
}
|
|
3348
|
-
|
|
3349
|
-
const
|
|
3350
|
-
if (
|
|
3351
|
-
return
|
|
3430
|
+
}
|
|
3431
|
+
return function(x) {
|
|
3432
|
+
const clampedX = Math.min(1, Math.max(0, x));
|
|
3433
|
+
if (mX1 === mY1 && mX2 === mY2) {
|
|
3434
|
+
return clampedX;
|
|
3352
3435
|
}
|
|
3353
|
-
if (
|
|
3354
|
-
|
|
3355
|
-
return 7.5625 * t2_ * t2_ + 0.75;
|
|
3436
|
+
if (clampedX === 0) {
|
|
3437
|
+
return 0;
|
|
3356
3438
|
}
|
|
3357
|
-
if (
|
|
3358
|
-
|
|
3359
|
-
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
3439
|
+
if (clampedX === 1) {
|
|
3440
|
+
return 1;
|
|
3360
3441
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
}
|
|
3364
|
-
static bezier(x1, y1, x2, y2) {
|
|
3365
|
-
return bezier(x1, y1, x2, y2);
|
|
3366
|
-
}
|
|
3367
|
-
static in(easing) {
|
|
3368
|
-
return easing;
|
|
3369
|
-
}
|
|
3370
|
-
static out(easing) {
|
|
3371
|
-
return (t) => 1 - easing(1 - t);
|
|
3372
|
-
}
|
|
3373
|
-
static inOut(easing) {
|
|
3374
|
-
return (t) => {
|
|
3375
|
-
if (t < 0.5) {
|
|
3376
|
-
return easing(t * 2) / 2;
|
|
3377
|
-
}
|
|
3378
|
-
return 1 - easing((1 - t) * 2) / 2;
|
|
3379
|
-
};
|
|
3380
|
-
}
|
|
3442
|
+
return calcBezier(getTForX(clampedX), mY1, mY2);
|
|
3443
|
+
};
|
|
3381
3444
|
}
|
|
3382
3445
|
var normalizeNumber = (value) => {
|
|
3383
3446
|
return Math.round(value * 1e6) / 1e6;
|
|
@@ -4009,7 +4072,7 @@ var interpolateDiscreteValue = ({
|
|
|
4009
4072
|
if (resolveEasingForSegment({
|
|
4010
4073
|
easing: options?.easing,
|
|
4011
4074
|
segmentIndex
|
|
4012
|
-
}) !==
|
|
4075
|
+
}) !== Easing2.step1) {
|
|
4013
4076
|
throw new TypeError(typeof outputRange[0] === "boolean" ? "Booleans can only be interpolated using Easing.step1" : "Non-numeric strings can only be interpolated using Easing.step1");
|
|
4014
4077
|
}
|
|
4015
4078
|
}
|
|
@@ -4089,7 +4152,7 @@ function checkInfiniteRange(name, arr) {
|
|
|
4089
4152
|
}
|
|
4090
4153
|
}
|
|
4091
4154
|
}
|
|
4092
|
-
function
|
|
4155
|
+
function assertValidInterpolateEasingOption2(easing, inputRangeLength) {
|
|
4093
4156
|
if (easing === undefined) {
|
|
4094
4157
|
return;
|
|
4095
4158
|
}
|
|
@@ -4106,7 +4169,7 @@ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
|
|
|
4106
4169
|
}
|
|
4107
4170
|
}
|
|
4108
4171
|
}
|
|
4109
|
-
function
|
|
4172
|
+
function assertValidInterpolatePosterizeOption2(posterize) {
|
|
4110
4173
|
if (posterize === undefined) {
|
|
4111
4174
|
return;
|
|
4112
4175
|
}
|
|
@@ -4126,7 +4189,7 @@ function assertValidInterpolateOutputType(outputType) {
|
|
|
4126
4189
|
}
|
|
4127
4190
|
throw new Error(\`outputType must be "font-weight", "scale", "translate", "rotate", or "transform-origin", but got \${String(outputType)}\`);
|
|
4128
4191
|
}
|
|
4129
|
-
function
|
|
4192
|
+
function interpolate2(input, inputRange, outputRange, options) {
|
|
4130
4193
|
if (typeof input === "undefined") {
|
|
4131
4194
|
throw new Error("input can not be undefined");
|
|
4132
4195
|
}
|
|
@@ -4141,8 +4204,8 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
4141
4204
|
}
|
|
4142
4205
|
checkInfiniteRange("inputRange", inputRange);
|
|
4143
4206
|
checkValidInputRange(inputRange);
|
|
4144
|
-
|
|
4145
|
-
|
|
4207
|
+
assertValidInterpolateEasingOption2(options?.easing, inputRange.length);
|
|
4208
|
+
assertValidInterpolatePosterizeOption2(options?.posterize);
|
|
4146
4209
|
assertValidInterpolateOutputOption(options?.output);
|
|
4147
4210
|
assertValidInterpolateOutputType(options?.outputType);
|
|
4148
4211
|
if (typeof input !== "number") {
|
|
@@ -4225,467 +4288,387 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
4225
4288
|
checkInfiniteRange("outputRange", outputRange);
|
|
4226
4289
|
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
4227
4290
|
}
|
|
4228
|
-
var
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
4233
|
-
throw new TypeError(\`defaultPremountInSeconds must be a finite, non-negative number, but got \${String(value)}.\`);
|
|
4234
|
-
}
|
|
4235
|
-
};
|
|
4236
|
-
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
4237
|
-
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
4238
|
-
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
4239
|
-
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
4240
|
-
var findPropsToDelete = ({
|
|
4241
|
-
schema,
|
|
4242
|
-
key,
|
|
4243
|
-
value
|
|
4291
|
+
var validateFrame = ({
|
|
4292
|
+
allowFloats,
|
|
4293
|
+
durationInFrames,
|
|
4294
|
+
frame
|
|
4244
4295
|
}) => {
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
throw new Error("Key " + JSON.stringify(key) + " not found in schema");
|
|
4296
|
+
if (typeof frame === "undefined") {
|
|
4297
|
+
throw new TypeError(\`Argument missing for parameter "frame"\`);
|
|
4248
4298
|
}
|
|
4249
|
-
if (typeof
|
|
4250
|
-
throw new
|
|
4299
|
+
if (typeof frame !== "number") {
|
|
4300
|
+
throw new TypeError(\`Argument passed for "frame" is not a number: \${frame}\`);
|
|
4251
4301
|
}
|
|
4252
|
-
if (
|
|
4253
|
-
throw new
|
|
4302
|
+
if (!Number.isFinite(frame)) {
|
|
4303
|
+
throw new RangeError(\`Frame \${frame} is not finite\`);
|
|
4254
4304
|
}
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
|
|
4305
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
4306
|
+
throw new RangeError(\`Argument for frame must be an integer, but got \${frame}\`);
|
|
4258
4307
|
}
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
for (const variant of otherVariants) {
|
|
4262
|
-
const otherVariant = fieldSchema.variants[variant];
|
|
4263
|
-
const keys = Object.keys(otherVariant);
|
|
4264
|
-
for (const k of keys) {
|
|
4265
|
-
otherKeys.add(k);
|
|
4266
|
-
}
|
|
4308
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
4309
|
+
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the lowest frame that can be rendered is \${-durationInFrames}\`);
|
|
4267
4310
|
}
|
|
4268
|
-
|
|
4269
|
-
};
|
|
4270
|
-
var registeredFontFaces = [];
|
|
4271
|
-
var fontDataByUrl = new Map;
|
|
4272
|
-
var fetchFontData = (fontUrl) => {
|
|
4273
|
-
const cached = fontDataByUrl.get(fontUrl);
|
|
4274
|
-
if (cached) {
|
|
4275
|
-
return cached;
|
|
4311
|
+
if (frame > durationInFrames - 1) {
|
|
4312
|
+
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the highest frame that can be rendered is \${durationInFrames - 1}\`);
|
|
4276
4313
|
}
|
|
4277
|
-
const promise = fetch(fontUrl).then((response) => {
|
|
4278
|
-
if (!response.ok) {
|
|
4279
|
-
throw new Error(\`Failed to load font \${JSON.stringify(fontUrl)}: \${response.status} \${response.statusText}\`);
|
|
4280
|
-
}
|
|
4281
|
-
return response.arrayBuffer();
|
|
4282
|
-
}).catch((error) => {
|
|
4283
|
-
fontDataByUrl.delete(fontUrl);
|
|
4284
|
-
throw error;
|
|
4285
|
-
});
|
|
4286
|
-
fontDataByUrl.set(fontUrl, promise);
|
|
4287
|
-
return promise;
|
|
4288
4314
|
};
|
|
4289
|
-
var
|
|
4290
|
-
if (
|
|
4315
|
+
var validateSpringDuration = (dur) => {
|
|
4316
|
+
if (typeof dur === "undefined") {
|
|
4291
4317
|
return;
|
|
4292
4318
|
}
|
|
4293
|
-
|
|
4294
|
-
};
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
}
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4319
|
+
if (typeof dur !== "number") {
|
|
4320
|
+
throw new TypeError(\`A "duration" of a spring must be a "number" but is "\${typeof dur}"\`);
|
|
4321
|
+
}
|
|
4322
|
+
if (Number.isNaN(dur)) {
|
|
4323
|
+
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
4324
|
+
}
|
|
4325
|
+
if (!Number.isFinite(dur)) {
|
|
4326
|
+
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
4327
|
+
}
|
|
4328
|
+
if (dur <= 0) {
|
|
4329
|
+
throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
|
|
4330
|
+
}
|
|
4331
|
+
};
|
|
4332
|
+
var defaultSpringConfig = {
|
|
4333
|
+
damping: 10,
|
|
4334
|
+
mass: 1,
|
|
4335
|
+
stiffness: 100,
|
|
4336
|
+
overshootClamping: false
|
|
4337
|
+
};
|
|
4338
|
+
var advanceCache = {};
|
|
4339
|
+
function advance({
|
|
4340
|
+
animation,
|
|
4341
|
+
now,
|
|
4342
|
+
config
|
|
4343
|
+
}) {
|
|
4344
|
+
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
4345
|
+
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
4346
|
+
if (config.damping <= 0) {
|
|
4347
|
+
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
4348
|
+
}
|
|
4349
|
+
const c = config.damping;
|
|
4350
|
+
const m = config.mass;
|
|
4351
|
+
const k = config.stiffness;
|
|
4352
|
+
const cacheKey = [
|
|
4353
|
+
toValue,
|
|
4354
|
+
lastTimestamp,
|
|
4355
|
+
current,
|
|
4356
|
+
velocity,
|
|
4357
|
+
c,
|
|
4358
|
+
m,
|
|
4359
|
+
k,
|
|
4360
|
+
now
|
|
4361
|
+
].join("-");
|
|
4362
|
+
if (advanceCache[cacheKey]) {
|
|
4363
|
+
return advanceCache[cacheKey];
|
|
4364
|
+
}
|
|
4365
|
+
const v0 = -velocity;
|
|
4366
|
+
const x0 = toValue - current;
|
|
4367
|
+
const zeta = c / (2 * Math.sqrt(k * m));
|
|
4368
|
+
const omega0 = Math.sqrt(k / m);
|
|
4369
|
+
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
4370
|
+
const t = deltaTime / 1000;
|
|
4371
|
+
const sin1 = Math.sin(omega1 * t);
|
|
4372
|
+
const cos1 = Math.cos(omega1 * t);
|
|
4373
|
+
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
4374
|
+
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
4375
|
+
const underDampedPosition = toValue - underDampedFrag1;
|
|
4376
|
+
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
4377
|
+
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
4378
|
+
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
4379
|
+
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
4380
|
+
const animationNode = {
|
|
4381
|
+
toValue,
|
|
4382
|
+
prevPosition: current,
|
|
4383
|
+
lastTimestamp: now,
|
|
4384
|
+
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
4385
|
+
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
4386
|
+
};
|
|
4387
|
+
advanceCache[cacheKey] = animationNode;
|
|
4388
|
+
return animationNode;
|
|
4389
|
+
}
|
|
4390
|
+
var calculationCache = {};
|
|
4391
|
+
function springCalculation({
|
|
4392
|
+
frame,
|
|
4393
|
+
fps,
|
|
4394
|
+
config = {}
|
|
4395
|
+
}) {
|
|
4396
|
+
const from = 0;
|
|
4397
|
+
const to = 1;
|
|
4398
|
+
const resolvedConfig = {
|
|
4399
|
+
damping: config.damping ?? defaultSpringConfig.damping,
|
|
4400
|
+
mass: config.mass ?? defaultSpringConfig.mass,
|
|
4401
|
+
stiffness: config.stiffness ?? defaultSpringConfig.stiffness,
|
|
4402
|
+
overshootClamping: config.overshootClamping ?? defaultSpringConfig.overshootClamping
|
|
4403
|
+
};
|
|
4404
|
+
const configKey = [
|
|
4405
|
+
fps,
|
|
4406
|
+
resolvedConfig.damping,
|
|
4407
|
+
resolvedConfig.mass,
|
|
4408
|
+
resolvedConfig.overshootClamping,
|
|
4409
|
+
resolvedConfig.stiffness
|
|
4410
|
+
].join("-");
|
|
4411
|
+
const cacheKey = \`\${frame}-\${configKey}\`;
|
|
4412
|
+
if (calculationCache[cacheKey]) {
|
|
4413
|
+
return calculationCache[cacheKey];
|
|
4414
|
+
}
|
|
4415
|
+
const frameClamped = Math.max(0, frame);
|
|
4416
|
+
const previousFrame = Math.ceil(frameClamped) - 1;
|
|
4417
|
+
const previousAnimation = previousFrame >= 0 ? calculationCache[\`\${previousFrame}-\${configKey}\`] : undefined;
|
|
4418
|
+
let animation = previousAnimation ?? {
|
|
4419
|
+
lastTimestamp: 0,
|
|
4420
|
+
current: from,
|
|
4421
|
+
toValue: to,
|
|
4422
|
+
velocity: 0,
|
|
4423
|
+
prevPosition: 0
|
|
4424
|
+
};
|
|
4425
|
+
const unevenRest = frameClamped % 1;
|
|
4426
|
+
const startFrame = previousAnimation ? previousFrame + 1 : 0;
|
|
4427
|
+
for (let f = startFrame;f <= Math.floor(frameClamped); f++) {
|
|
4428
|
+
const time = f / fps * 1000;
|
|
4429
|
+
animation = advance({
|
|
4430
|
+
animation,
|
|
4431
|
+
now: time,
|
|
4432
|
+
config: resolvedConfig
|
|
4433
|
+
});
|
|
4434
|
+
}
|
|
4435
|
+
if (unevenRest > 0) {
|
|
4436
|
+
animation = advance({
|
|
4437
|
+
animation,
|
|
4438
|
+
now: frameClamped / fps * 1000,
|
|
4439
|
+
config: resolvedConfig
|
|
4440
|
+
});
|
|
4441
|
+
}
|
|
4442
|
+
calculationCache[cacheKey] = animation;
|
|
4443
|
+
return animation;
|
|
4444
|
+
}
|
|
4445
|
+
var cache = new Map;
|
|
4446
|
+
function measureSpring2({
|
|
4447
|
+
fps,
|
|
4448
|
+
config = {},
|
|
4449
|
+
threshold = 0.005
|
|
4450
|
+
}) {
|
|
4451
|
+
if (typeof threshold !== "number") {
|
|
4452
|
+
throw new TypeError(\`threshold must be a number, got \${threshold} of type \${typeof threshold}\`);
|
|
4453
|
+
}
|
|
4454
|
+
if (threshold === 0) {
|
|
4455
|
+
return Infinity;
|
|
4456
|
+
}
|
|
4457
|
+
if (threshold === 1) {
|
|
4458
|
+
return 0;
|
|
4459
|
+
}
|
|
4460
|
+
if (isNaN(threshold)) {
|
|
4461
|
+
throw new TypeError("Threshold is NaN");
|
|
4462
|
+
}
|
|
4463
|
+
if (!Number.isFinite(threshold)) {
|
|
4464
|
+
throw new TypeError("Threshold is not finite");
|
|
4465
|
+
}
|
|
4466
|
+
if (threshold < 0) {
|
|
4467
|
+
throw new TypeError("Threshold is below 0");
|
|
4333
4468
|
}
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
if (
|
|
4343
|
-
return
|
|
4469
|
+
const cacheKey = [
|
|
4470
|
+
fps,
|
|
4471
|
+
config.damping,
|
|
4472
|
+
config.mass,
|
|
4473
|
+
config.overshootClamping,
|
|
4474
|
+
config.stiffness,
|
|
4475
|
+
threshold
|
|
4476
|
+
].join("-");
|
|
4477
|
+
if (cache.has(cacheKey)) {
|
|
4478
|
+
return cache.get(cacheKey);
|
|
4344
4479
|
}
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4480
|
+
validateFps(fps, "to the measureSpring() function", false);
|
|
4481
|
+
let frame = 0;
|
|
4482
|
+
let finishedFrame = 0;
|
|
4483
|
+
const calc = () => {
|
|
4484
|
+
return springCalculation({
|
|
4485
|
+
fps,
|
|
4486
|
+
frame,
|
|
4487
|
+
config
|
|
4488
|
+
});
|
|
4489
|
+
};
|
|
4490
|
+
let animation = calc();
|
|
4491
|
+
const calcDifference = () => {
|
|
4492
|
+
return Math.abs(animation.current - animation.toValue);
|
|
4493
|
+
};
|
|
4494
|
+
let difference = calcDifference();
|
|
4495
|
+
while (difference >= threshold) {
|
|
4496
|
+
frame++;
|
|
4497
|
+
animation = calc();
|
|
4498
|
+
difference = calcDifference();
|
|
4499
|
+
}
|
|
4500
|
+
finishedFrame = frame;
|
|
4501
|
+
for (let i = 0;i < 20; i++) {
|
|
4502
|
+
frame++;
|
|
4503
|
+
animation = calc();
|
|
4504
|
+
difference = calcDifference();
|
|
4505
|
+
if (difference >= threshold) {
|
|
4506
|
+
i = 0;
|
|
4507
|
+
finishedFrame = frame + 1;
|
|
4354
4508
|
}
|
|
4355
|
-
return value;
|
|
4356
|
-
});
|
|
4357
|
-
};
|
|
4358
|
-
var transformSchema = {
|
|
4359
|
-
"style.transformOrigin": {
|
|
4360
|
-
type: "transform-origin",
|
|
4361
|
-
step: 1,
|
|
4362
|
-
default: "50% 50%",
|
|
4363
|
-
description: "Transform origin"
|
|
4364
|
-
},
|
|
4365
|
-
"style.translate": {
|
|
4366
|
-
type: "translate",
|
|
4367
|
-
step: 1,
|
|
4368
|
-
default: "0px 0px",
|
|
4369
|
-
description: "Offset"
|
|
4370
|
-
},
|
|
4371
|
-
"style.scale": {
|
|
4372
|
-
type: "scale",
|
|
4373
|
-
max: 100,
|
|
4374
|
-
step: 0.01,
|
|
4375
|
-
default: 1,
|
|
4376
|
-
description: "Scale",
|
|
4377
|
-
defaultKeyframeOutput: "perceptual-scale"
|
|
4378
|
-
},
|
|
4379
|
-
"style.rotate": {
|
|
4380
|
-
type: "rotation-css",
|
|
4381
|
-
step: 1,
|
|
4382
|
-
default: "0deg",
|
|
4383
|
-
description: "Rotation"
|
|
4384
|
-
},
|
|
4385
|
-
"style.opacity": {
|
|
4386
|
-
type: "number",
|
|
4387
|
-
min: 0,
|
|
4388
|
-
max: 1,
|
|
4389
|
-
step: 0.01,
|
|
4390
|
-
default: 1,
|
|
4391
|
-
description: "Opacity",
|
|
4392
|
-
hiddenFromList: false
|
|
4393
4509
|
}
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4510
|
+
cache.set(cacheKey, finishedFrame);
|
|
4511
|
+
return finishedFrame;
|
|
4512
|
+
}
|
|
4513
|
+
function spring2({
|
|
4514
|
+
frame: passedFrame,
|
|
4515
|
+
fps,
|
|
4516
|
+
config = {},
|
|
4517
|
+
from = 0,
|
|
4518
|
+
to = 1,
|
|
4519
|
+
durationInFrames: passedDurationInFrames,
|
|
4520
|
+
durationRestThreshold,
|
|
4521
|
+
delay = 0,
|
|
4522
|
+
reverse = false
|
|
4523
|
+
}) {
|
|
4524
|
+
validateSpringDuration(passedDurationInFrames);
|
|
4525
|
+
validateFrame({
|
|
4526
|
+
frame: passedFrame,
|
|
4527
|
+
durationInFrames: Infinity,
|
|
4528
|
+
allowFloats: true
|
|
4529
|
+
});
|
|
4530
|
+
validateFps(fps, "to spring()", false);
|
|
4531
|
+
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
4532
|
+
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring2({
|
|
4533
|
+
fps,
|
|
4534
|
+
config,
|
|
4535
|
+
threshold: durationRestThreshold
|
|
4536
|
+
}) : undefined;
|
|
4537
|
+
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
4538
|
+
get: () => naturalDuration
|
|
4539
|
+
} : {
|
|
4540
|
+
get: () => {
|
|
4541
|
+
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
4419
4542
|
}
|
|
4420
|
-
}
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4543
|
+
};
|
|
4544
|
+
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
4545
|
+
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
4546
|
+
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
4547
|
+
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
4548
|
+
return to;
|
|
4425
4549
|
}
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
description: "Top left radius",
|
|
4443
|
-
hiddenFromList: false
|
|
4444
|
-
},
|
|
4445
|
-
"style.borderTopRightRadius": {
|
|
4446
|
-
type: "number",
|
|
4447
|
-
default: 0,
|
|
4448
|
-
min: 0,
|
|
4449
|
-
step: 1,
|
|
4450
|
-
description: "Top right radius",
|
|
4451
|
-
hiddenFromList: false
|
|
4452
|
-
},
|
|
4453
|
-
"style.borderBottomRightRadius": {
|
|
4454
|
-
type: "number",
|
|
4455
|
-
default: 0,
|
|
4456
|
-
min: 0,
|
|
4457
|
-
step: 1,
|
|
4458
|
-
description: "Bottom right radius",
|
|
4459
|
-
hiddenFromList: false
|
|
4460
|
-
},
|
|
4461
|
-
"style.borderBottomLeftRadius": {
|
|
4462
|
-
type: "number",
|
|
4463
|
-
default: 0,
|
|
4464
|
-
min: 0,
|
|
4465
|
-
step: 1,
|
|
4466
|
-
description: "Bottom left radius",
|
|
4467
|
-
hiddenFromList: false
|
|
4550
|
+
const spr = springCalculation({
|
|
4551
|
+
fps,
|
|
4552
|
+
frame: durationProcessed,
|
|
4553
|
+
config
|
|
4554
|
+
});
|
|
4555
|
+
const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
|
|
4556
|
+
const interpolated = from === 0 && to === 1 ? inner : interpolate2(inner, [0, 1], [from, to]);
|
|
4557
|
+
return interpolated;
|
|
4558
|
+
}
|
|
4559
|
+
var clampUnit = (t) => Math.min(1, Math.max(0, t));
|
|
4560
|
+
var springEasingDurationInFrames = 30;
|
|
4561
|
+
var easeBezier = null;
|
|
4562
|
+
|
|
4563
|
+
class Easing2 {
|
|
4564
|
+
static step0(n) {
|
|
4565
|
+
return n > 0 ? 1 : 0;
|
|
4468
4566
|
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
"style.backgroundColor": {
|
|
4472
|
-
type: "color",
|
|
4473
|
-
default: "transparent",
|
|
4474
|
-
description: "Color"
|
|
4567
|
+
static step1(n) {
|
|
4568
|
+
return n >= 1 ? 1 : 0;
|
|
4475
4569
|
}
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
color: {
|
|
4479
|
-
type: "color",
|
|
4480
|
-
default: undefined,
|
|
4481
|
-
description: "Current color"
|
|
4570
|
+
static linear(t) {
|
|
4571
|
+
return t;
|
|
4482
4572
|
}
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
stroke: {
|
|
4487
|
-
type: "color",
|
|
4488
|
-
default: "none",
|
|
4489
|
-
description: "Stroke"
|
|
4490
|
-
},
|
|
4491
|
-
strokeWidth: {
|
|
4492
|
-
type: "number",
|
|
4493
|
-
default: 1,
|
|
4494
|
-
description: "Stroke width",
|
|
4495
|
-
min: 0,
|
|
4496
|
-
step: 1,
|
|
4497
|
-
hiddenFromList: false
|
|
4573
|
+
static ease(t) {
|
|
4574
|
+
easeBezier ??= Easing2.bezier(0.42, 0, 1, 1);
|
|
4575
|
+
return easeBezier(t);
|
|
4498
4576
|
}
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
fill: {
|
|
4502
|
-
type: "color",
|
|
4503
|
-
default: undefined,
|
|
4504
|
-
description: "Fill"
|
|
4505
|
-
},
|
|
4506
|
-
...svgStrokeSchema
|
|
4507
|
-
};
|
|
4508
|
-
var premountSchema = {
|
|
4509
|
-
premountFor: {
|
|
4510
|
-
type: "number",
|
|
4511
|
-
default: undefined,
|
|
4512
|
-
description: "Premount For",
|
|
4513
|
-
min: 0,
|
|
4514
|
-
step: 1,
|
|
4515
|
-
hiddenFromList: false,
|
|
4516
|
-
keyframable: false
|
|
4517
|
-
},
|
|
4518
|
-
postmountFor: {
|
|
4519
|
-
type: "number",
|
|
4520
|
-
default: 0,
|
|
4521
|
-
min: 0,
|
|
4522
|
-
step: 1,
|
|
4523
|
-
hiddenFromList: true,
|
|
4524
|
-
keyframable: false
|
|
4577
|
+
static quad(t) {
|
|
4578
|
+
return t * t;
|
|
4525
4579
|
}
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
...premountSchema
|
|
4529
|
-
};
|
|
4530
|
-
var cropSchema = {
|
|
4531
|
-
cropLeft: {
|
|
4532
|
-
type: "number",
|
|
4533
|
-
default: 0,
|
|
4534
|
-
description: "Crop left",
|
|
4535
|
-
min: 0,
|
|
4536
|
-
max: 1,
|
|
4537
|
-
step: 0.01,
|
|
4538
|
-
hiddenFromList: false,
|
|
4539
|
-
keyframable: true
|
|
4540
|
-
},
|
|
4541
|
-
cropRight: {
|
|
4542
|
-
type: "number",
|
|
4543
|
-
default: 0,
|
|
4544
|
-
description: "Crop right",
|
|
4545
|
-
min: 0,
|
|
4546
|
-
max: 1,
|
|
4547
|
-
step: 0.01,
|
|
4548
|
-
hiddenFromList: false,
|
|
4549
|
-
keyframable: true
|
|
4550
|
-
},
|
|
4551
|
-
cropTop: {
|
|
4552
|
-
type: "number",
|
|
4553
|
-
default: 0,
|
|
4554
|
-
description: "Crop top",
|
|
4555
|
-
min: 0,
|
|
4556
|
-
max: 1,
|
|
4557
|
-
step: 0.01,
|
|
4558
|
-
hiddenFromList: false,
|
|
4559
|
-
keyframable: true
|
|
4560
|
-
},
|
|
4561
|
-
cropBottom: {
|
|
4562
|
-
type: "number",
|
|
4563
|
-
default: 0,
|
|
4564
|
-
description: "Crop bottom",
|
|
4565
|
-
min: 0,
|
|
4566
|
-
max: 1,
|
|
4567
|
-
step: 0.01,
|
|
4568
|
-
hiddenFromList: false,
|
|
4569
|
-
keyframable: true
|
|
4580
|
+
static cubic(t) {
|
|
4581
|
+
return t * t * t;
|
|
4570
4582
|
}
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
var sequenceStyleSchema = {
|
|
4574
|
-
...sequenceCropSchema,
|
|
4575
|
-
...transformSchema,
|
|
4576
|
-
...backgroundSchema,
|
|
4577
|
-
...borderSchema,
|
|
4578
|
-
...borderRadiusSchema,
|
|
4579
|
-
...sequencePremountSchema
|
|
4580
|
-
};
|
|
4581
|
-
var hiddenField = {
|
|
4582
|
-
type: "boolean",
|
|
4583
|
-
default: false,
|
|
4584
|
-
description: "Hidden"
|
|
4585
|
-
};
|
|
4586
|
-
var showInTimelineField = {
|
|
4587
|
-
type: "hidden"
|
|
4588
|
-
};
|
|
4589
|
-
var sequenceNameField = {
|
|
4590
|
-
type: "hidden"
|
|
4591
|
-
};
|
|
4592
|
-
var durationInFramesField = {
|
|
4593
|
-
type: "number",
|
|
4594
|
-
default: undefined,
|
|
4595
|
-
min: 1,
|
|
4596
|
-
step: 1,
|
|
4597
|
-
hiddenFromList: true
|
|
4598
|
-
};
|
|
4599
|
-
var fromField = {
|
|
4600
|
-
type: "number",
|
|
4601
|
-
default: 0,
|
|
4602
|
-
step: 1,
|
|
4603
|
-
hiddenFromList: true
|
|
4604
|
-
};
|
|
4605
|
-
var trimBeforeField = {
|
|
4606
|
-
type: "number",
|
|
4607
|
-
default: 0,
|
|
4608
|
-
min: 0,
|
|
4609
|
-
step: 1,
|
|
4610
|
-
hiddenFromList: true
|
|
4611
|
-
};
|
|
4612
|
-
var sequenceTimingSchema = {
|
|
4613
|
-
from: {
|
|
4614
|
-
...fromField,
|
|
4615
|
-
description: "From",
|
|
4616
|
-
hiddenFromList: false,
|
|
4617
|
-
keyframable: false
|
|
4618
|
-
},
|
|
4619
|
-
durationInFrames: {
|
|
4620
|
-
...durationInFramesField,
|
|
4621
|
-
description: "Duration",
|
|
4622
|
-
hiddenFromList: false,
|
|
4623
|
-
keyframable: false
|
|
4624
|
-
},
|
|
4625
|
-
trimBefore: {
|
|
4626
|
-
...trimBeforeField,
|
|
4627
|
-
description: "Trim before",
|
|
4628
|
-
hiddenFromList: false,
|
|
4629
|
-
keyframable: false
|
|
4583
|
+
static poly(n) {
|
|
4584
|
+
return (t) => t ** n;
|
|
4630
4585
|
}
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
}
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
}
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4586
|
+
static sin(t) {
|
|
4587
|
+
return 1 - Math.cos(t * Math.PI / 2);
|
|
4588
|
+
}
|
|
4589
|
+
static circle(t) {
|
|
4590
|
+
const u = clampUnit(t);
|
|
4591
|
+
return 1 - Math.sqrt(1 - u * u);
|
|
4592
|
+
}
|
|
4593
|
+
static exp(t) {
|
|
4594
|
+
return 2 ** (10 * (t - 1));
|
|
4595
|
+
}
|
|
4596
|
+
static elastic(bounciness = 1) {
|
|
4597
|
+
const p = bounciness * Math.PI;
|
|
4598
|
+
return (t) => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p);
|
|
4599
|
+
}
|
|
4600
|
+
static back(s = 1.70158) {
|
|
4601
|
+
return (t) => t * t * ((s + 1) * t - s);
|
|
4602
|
+
}
|
|
4603
|
+
static spring({
|
|
4604
|
+
allowTail = false,
|
|
4605
|
+
durationRestThreshold,
|
|
4606
|
+
...config
|
|
4607
|
+
} = {}) {
|
|
4608
|
+
const easing = (t) => {
|
|
4609
|
+
if (t <= 0) {
|
|
4610
|
+
return 0;
|
|
4611
|
+
}
|
|
4612
|
+
if (!allowTail && t >= 1) {
|
|
4613
|
+
return 1;
|
|
4614
|
+
}
|
|
4615
|
+
if (allowTail) {
|
|
4616
|
+
return spring2({
|
|
4617
|
+
fps: springEasingDurationInFrames,
|
|
4618
|
+
frame: t * measureSpring2({
|
|
4619
|
+
fps: springEasingDurationInFrames,
|
|
4620
|
+
config,
|
|
4621
|
+
threshold: durationRestThreshold
|
|
4622
|
+
}),
|
|
4623
|
+
config
|
|
4624
|
+
});
|
|
4625
|
+
}
|
|
4626
|
+
return spring2({
|
|
4627
|
+
fps: springEasingDurationInFrames,
|
|
4628
|
+
frame: t * springEasingDurationInFrames,
|
|
4629
|
+
config,
|
|
4630
|
+
durationInFrames: springEasingDurationInFrames,
|
|
4631
|
+
durationRestThreshold
|
|
4632
|
+
});
|
|
4633
|
+
};
|
|
4634
|
+
return Object.assign(easing, {
|
|
4635
|
+
remotionShouldExtendRight: allowTail
|
|
4636
|
+
});
|
|
4637
|
+
}
|
|
4638
|
+
static bounce(t) {
|
|
4639
|
+
const u = clampUnit(t);
|
|
4640
|
+
if (u < 1 / 2.75) {
|
|
4641
|
+
return 7.5625 * u * u;
|
|
4666
4642
|
}
|
|
4643
|
+
if (u < 2 / 2.75) {
|
|
4644
|
+
const t2_ = u - 1.5 / 2.75;
|
|
4645
|
+
return 7.5625 * t2_ * t2_ + 0.75;
|
|
4646
|
+
}
|
|
4647
|
+
if (u < 2.5 / 2.75) {
|
|
4648
|
+
const t2_ = u - 2.25 / 2.75;
|
|
4649
|
+
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
4650
|
+
}
|
|
4651
|
+
const t2 = u - 2.625 / 2.75;
|
|
4652
|
+
return 7.5625 * t2 * t2 + 0.984375;
|
|
4667
4653
|
}
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
durationInFrames: durationInFramesField,
|
|
4671
|
-
trimBefore: trimBeforeField,
|
|
4672
|
-
playbackRate: playbackRateField,
|
|
4673
|
-
freeze: freezeField,
|
|
4674
|
-
hidden: hiddenField,
|
|
4675
|
-
name: sequenceNameField,
|
|
4676
|
-
showInTimeline: showInTimelineField
|
|
4677
|
-
};
|
|
4678
|
-
var sequenceSchemaWithoutFrom = {
|
|
4679
|
-
...baseSchemaWithoutFrom,
|
|
4680
|
-
layout: sequenceSchema.layout
|
|
4681
|
-
};
|
|
4682
|
-
var sequenceSchemaDefaultLayoutNone = {
|
|
4683
|
-
...sequenceSchema,
|
|
4684
|
-
layout: {
|
|
4685
|
-
...sequenceSchema.layout,
|
|
4686
|
-
default: "none"
|
|
4654
|
+
static bezier(x1, y1, x2, y2) {
|
|
4655
|
+
return bezier(x1, y1, x2, y2);
|
|
4687
4656
|
}
|
|
4688
|
-
|
|
4657
|
+
static in(easing) {
|
|
4658
|
+
return easing;
|
|
4659
|
+
}
|
|
4660
|
+
static out(easing) {
|
|
4661
|
+
return (t) => 1 - easing(1 - t);
|
|
4662
|
+
}
|
|
4663
|
+
static inOut(easing) {
|
|
4664
|
+
return (t) => {
|
|
4665
|
+
if (t < 0.5) {
|
|
4666
|
+
return easing(t * 2) / 2;
|
|
4667
|
+
}
|
|
4668
|
+
return 1 - easing((1 - t) * 2) / 2;
|
|
4669
|
+
};
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4689
4672
|
var NUMBER = "[-+]?\\\\d*\\\\.?\\\\d+";
|
|
4690
4673
|
var PERCENTAGE = NUMBER + "%";
|
|
4691
4674
|
function call(...args) {
|
|
@@ -5137,6 +5120,119 @@ function processColor(color) {
|
|
|
5137
5120
|
const normalizedColor = normalizeColor(color);
|
|
5138
5121
|
return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
|
|
5139
5122
|
}
|
|
5123
|
+
var findPropsToDelete = ({
|
|
5124
|
+
schema,
|
|
5125
|
+
key,
|
|
5126
|
+
value
|
|
5127
|
+
}) => {
|
|
5128
|
+
const fieldSchema = schema[key];
|
|
5129
|
+
if (!fieldSchema) {
|
|
5130
|
+
throw new Error("Key " + JSON.stringify(key) + " not found in schema");
|
|
5131
|
+
}
|
|
5132
|
+
if (typeof value !== "string") {
|
|
5133
|
+
throw new Error("Value must be a string, but is " + JSON.stringify(value));
|
|
5134
|
+
}
|
|
5135
|
+
if (fieldSchema.type !== "enum") {
|
|
5136
|
+
throw new Error("Key " + JSON.stringify(key) + " is not an enum");
|
|
5137
|
+
}
|
|
5138
|
+
const currentVariant = fieldSchema.variants[value];
|
|
5139
|
+
if (!currentVariant) {
|
|
5140
|
+
throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
|
|
5141
|
+
}
|
|
5142
|
+
const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
|
|
5143
|
+
const otherKeys = new Set;
|
|
5144
|
+
for (const variant of otherVariants) {
|
|
5145
|
+
const otherVariant = fieldSchema.variants[variant];
|
|
5146
|
+
const keys = Object.keys(otherVariant);
|
|
5147
|
+
for (const k of keys) {
|
|
5148
|
+
otherKeys.add(k);
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
return [...otherKeys];
|
|
5152
|
+
};
|
|
5153
|
+
var validatePreferredEffectBackend = (value) => {
|
|
5154
|
+
if (value !== "auto" && value !== "webgpu" && value !== "webgl2" && value !== "2d") {
|
|
5155
|
+
throw new TypeError(\`preferredEffectBackend must be "auto", "webgpu", "webgl2" or "2d", got \${String(value)}\`);
|
|
5156
|
+
}
|
|
5157
|
+
return value;
|
|
5158
|
+
};
|
|
5159
|
+
var getAbsoluteSrc = (relativeSrc) => {
|
|
5160
|
+
if (typeof window === "undefined") {
|
|
5161
|
+
return relativeSrc;
|
|
5162
|
+
}
|
|
5163
|
+
if (relativeSrc.startsWith("http://") || relativeSrc.startsWith("https://") || relativeSrc.startsWith("file://") || relativeSrc.startsWith("blob:") || relativeSrc.startsWith("data:")) {
|
|
5164
|
+
return relativeSrc;
|
|
5165
|
+
}
|
|
5166
|
+
return new URL(relativeSrc, document.baseURI).href;
|
|
5167
|
+
};
|
|
5168
|
+
var getExpectedMediaFrameUncorrected = ({
|
|
5169
|
+
frame,
|
|
5170
|
+
playbackRate,
|
|
5171
|
+
startFrom
|
|
5172
|
+
}) => {
|
|
5173
|
+
return interpolate2(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
5174
|
+
};
|
|
5175
|
+
var validCodecs = [
|
|
5176
|
+
"h264",
|
|
5177
|
+
"h265",
|
|
5178
|
+
"vp8",
|
|
5179
|
+
"vp9",
|
|
5180
|
+
"av1",
|
|
5181
|
+
"mp3",
|
|
5182
|
+
"aac",
|
|
5183
|
+
"wav",
|
|
5184
|
+
"prores",
|
|
5185
|
+
"h264-mkv",
|
|
5186
|
+
"h264-ts",
|
|
5187
|
+
"gif"
|
|
5188
|
+
];
|
|
5189
|
+
function validateCodec(defaultCodec, location, name) {
|
|
5190
|
+
if (typeof defaultCodec === "undefined") {
|
|
5191
|
+
return;
|
|
5192
|
+
}
|
|
5193
|
+
if (typeof defaultCodec !== "string") {
|
|
5194
|
+
throw new TypeError(\`The "\${name}" prop \${location} must be a string, but you passed a value of type \${typeof defaultCodec}.\`);
|
|
5195
|
+
}
|
|
5196
|
+
if (!validCodecs.includes(defaultCodec)) {
|
|
5197
|
+
throw new Error(\`The "\${name}" prop \${location} must be one of \${validCodecs.join(", ")}, but you passed \${defaultCodec}.\`);
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
var getOffthreadVideoSource = ({
|
|
5201
|
+
src,
|
|
5202
|
+
transparent,
|
|
5203
|
+
currentTime,
|
|
5204
|
+
toneMapped
|
|
5205
|
+
}) => {
|
|
5206
|
+
return \`http://localhost:\${window.remotion_proxyPort}/proxy?src=\${encodeURIComponent(getAbsoluteSrc(src))}&time=\${encodeURIComponent(Math.max(0, currentTime))}&transparent=\${String(transparent)}&toneMapped=\${String(toneMapped)}\`;
|
|
5207
|
+
};
|
|
5208
|
+
var registeredFontFaces = [];
|
|
5209
|
+
var fontDataByUrl = new Map;
|
|
5210
|
+
var fetchFontData = (fontUrl) => {
|
|
5211
|
+
const cached = fontDataByUrl.get(fontUrl);
|
|
5212
|
+
if (cached) {
|
|
5213
|
+
return cached;
|
|
5214
|
+
}
|
|
5215
|
+
const promise = fetch(fontUrl).then((response) => {
|
|
5216
|
+
if (!response.ok) {
|
|
5217
|
+
throw new Error(\`Failed to load font \${JSON.stringify(fontUrl)}: \${response.status} \${response.statusText}\`);
|
|
5218
|
+
}
|
|
5219
|
+
return response.arrayBuffer();
|
|
5220
|
+
}).catch((error) => {
|
|
5221
|
+
fontDataByUrl.delete(fontUrl);
|
|
5222
|
+
throw error;
|
|
5223
|
+
});
|
|
5224
|
+
fontDataByUrl.set(fontUrl, promise);
|
|
5225
|
+
return promise;
|
|
5226
|
+
};
|
|
5227
|
+
var registerFontFace = (fontFace) => {
|
|
5228
|
+
if (registeredFontFaces.some((registered) => registered.ascentOverride === fontFace.ascentOverride && registered.descentOverride === fontFace.descentOverride && registered.display === fontFace.display && registered.featureSettings === fontFace.featureSettings && registered.fontFamily === fontFace.fontFamily && registered.fontUrl === fontFace.fontUrl && registered.format === fontFace.format && registered.lineGapOverride === fontFace.lineGapOverride && registered.style === fontFace.style && registered.weight === fontFace.weight && registered.stretch === fontFace.stretch && registered.unicodeRange === fontFace.unicodeRange && registered.variant === fontFace.variant)) {
|
|
5229
|
+
return;
|
|
5230
|
+
}
|
|
5231
|
+
registeredFontFaces.push(fontFace);
|
|
5232
|
+
};
|
|
5233
|
+
var getRegisteredFontFaces = () => {
|
|
5234
|
+
return registeredFontFaces.slice();
|
|
5235
|
+
};
|
|
5140
5236
|
var proResProfileOptions = [
|
|
5141
5237
|
"4444-xq",
|
|
5142
5238
|
"4444",
|
|
@@ -5184,9 +5280,6 @@ var serializeScaleValue = ([x, y, z]) => {
|
|
|
5184
5280
|
}
|
|
5185
5281
|
return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
|
|
5186
5282
|
};
|
|
5187
|
-
function truthy(value) {
|
|
5188
|
-
return Boolean(value);
|
|
5189
|
-
}
|
|
5190
5283
|
var validateSelectedFrames = ({
|
|
5191
5284
|
frames,
|
|
5192
5285
|
durationInFrames
|
|
@@ -5220,102 +5313,7 @@ var validateSelectedFrames = ({
|
|
|
5220
5313
|
}
|
|
5221
5314
|
return [...frames].sort((a, b) => a - b);
|
|
5222
5315
|
};
|
|
5223
|
-
var
|
|
5224
|
-
"h264",
|
|
5225
|
-
"h265",
|
|
5226
|
-
"vp8",
|
|
5227
|
-
"vp9",
|
|
5228
|
-
"av1",
|
|
5229
|
-
"mp3",
|
|
5230
|
-
"aac",
|
|
5231
|
-
"wav",
|
|
5232
|
-
"prores",
|
|
5233
|
-
"h264-mkv",
|
|
5234
|
-
"h264-ts",
|
|
5235
|
-
"gif"
|
|
5236
|
-
];
|
|
5237
|
-
function validateCodec(defaultCodec, location, name) {
|
|
5238
|
-
if (typeof defaultCodec === "undefined") {
|
|
5239
|
-
return;
|
|
5240
|
-
}
|
|
5241
|
-
if (typeof defaultCodec !== "string") {
|
|
5242
|
-
throw new TypeError(\`The "\${name}" prop \${location} must be a string, but you passed a value of type \${typeof defaultCodec}.\`);
|
|
5243
|
-
}
|
|
5244
|
-
if (!validCodecs.includes(defaultCodec)) {
|
|
5245
|
-
throw new Error(\`The "\${name}" prop \${location} must be one of \${validCodecs.join(", ")}, but you passed \${defaultCodec}.\`);
|
|
5246
|
-
}
|
|
5247
|
-
}
|
|
5248
|
-
var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
5249
|
-
if (!defaultProps) {
|
|
5250
|
-
return;
|
|
5251
|
-
}
|
|
5252
|
-
if (typeof defaultProps !== "object") {
|
|
5253
|
-
throw new Error(\`"\${name}" must be an object, but you passed a value of type \${typeof defaultProps}\`);
|
|
5254
|
-
}
|
|
5255
|
-
if (Array.isArray(defaultProps)) {
|
|
5256
|
-
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
5257
|
-
}
|
|
5258
|
-
};
|
|
5259
|
-
function validateDimension(amount, nameOfProp, location) {
|
|
5260
|
-
if (typeof amount !== "number") {
|
|
5261
|
-
throw new Error(\`The "\${nameOfProp}" prop \${location} must be a number, but you passed a value of type \${typeof amount}\`);
|
|
5262
|
-
}
|
|
5263
|
-
if (isNaN(amount)) {
|
|
5264
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must not be NaN, but is NaN.\`);
|
|
5265
|
-
}
|
|
5266
|
-
if (!Number.isFinite(amount)) {
|
|
5267
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
5268
|
-
}
|
|
5269
|
-
if (amount % 1 !== 0) {
|
|
5270
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
5271
|
-
}
|
|
5272
|
-
if (amount <= 0) {
|
|
5273
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be positive, but got \${amount}.\`);
|
|
5274
|
-
}
|
|
5275
|
-
}
|
|
5276
|
-
function validateDurationInFrames(durationInFrames, options) {
|
|
5277
|
-
const { allowFloats, component } = options;
|
|
5278
|
-
if (typeof durationInFrames === "undefined") {
|
|
5279
|
-
throw new Error(\`The "durationInFrames" prop \${component} is missing.\`);
|
|
5280
|
-
}
|
|
5281
|
-
if (typeof durationInFrames !== "number") {
|
|
5282
|
-
throw new Error(\`The "durationInFrames" prop \${component} must be a number, but you passed a value of type \${typeof durationInFrames}\`);
|
|
5283
|
-
}
|
|
5284
|
-
if (durationInFrames <= 0) {
|
|
5285
|
-
throw new TypeError(\`The "durationInFrames" prop \${component} must be positive, but got \${durationInFrames}.\`);
|
|
5286
|
-
}
|
|
5287
|
-
if (!Number.isFinite(durationInFrames)) {
|
|
5288
|
-
throw new TypeError(\`The "durationInFrames" prop \${component} must be finite, but got \${durationInFrames}.\`);
|
|
5289
|
-
}
|
|
5290
|
-
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
5291
|
-
throw new TypeError(\`The "durationInFrames" prop \${component} must be an integer, but got \${durationInFrames}.\`);
|
|
5292
|
-
}
|
|
5293
|
-
}
|
|
5294
|
-
var getExpectedMediaFrameUncorrected = ({
|
|
5295
|
-
frame,
|
|
5296
|
-
playbackRate,
|
|
5297
|
-
startFrom
|
|
5298
|
-
}) => {
|
|
5299
|
-
return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
5300
|
-
};
|
|
5301
|
-
var getAbsoluteSrc = (relativeSrc) => {
|
|
5302
|
-
if (typeof window === "undefined") {
|
|
5303
|
-
return relativeSrc;
|
|
5304
|
-
}
|
|
5305
|
-
if (relativeSrc.startsWith("http://") || relativeSrc.startsWith("https://") || relativeSrc.startsWith("file://") || relativeSrc.startsWith("blob:") || relativeSrc.startsWith("data:")) {
|
|
5306
|
-
return relativeSrc;
|
|
5307
|
-
}
|
|
5308
|
-
return new URL(relativeSrc, document.baseURI).href;
|
|
5309
|
-
};
|
|
5310
|
-
var getOffthreadVideoSource = ({
|
|
5311
|
-
src,
|
|
5312
|
-
transparent,
|
|
5313
|
-
currentTime,
|
|
5314
|
-
toneMapped
|
|
5315
|
-
}) => {
|
|
5316
|
-
return \`http://localhost:\${window.remotion_proxyPort}/proxy?src=\${encodeURIComponent(getAbsoluteSrc(src))}&time=\${encodeURIComponent(Math.max(0, currentTime))}&transparent=\${String(transparent)}&toneMapped=\${String(toneMapped)}\`;
|
|
5317
|
-
};
|
|
5318
|
-
var NoReactInternals = {
|
|
5316
|
+
var NoReactInternals2 = {
|
|
5319
5317
|
validatePreferredEffectBackend,
|
|
5320
5318
|
DEFAULT_PREMOUNT_IN_SECONDS,
|
|
5321
5319
|
DEFAULT_STUDIO_PREMOUNT_IN_SECONDS,
|
|
@@ -5406,7 +5404,7 @@ var uploadToVercelBlob = async ({
|
|
|
5406
5404
|
return { url: blob.downloadUrl, size };
|
|
5407
5405
|
};
|
|
5408
5406
|
try {
|
|
5409
|
-
const serializedInputProps =
|
|
5407
|
+
const serializedInputProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
5410
5408
|
data: config.inputProps,
|
|
5411
5409
|
indent: undefined,
|
|
5412
5410
|
staticBase: null
|
|
@@ -5453,7 +5451,7 @@ try {
|
|
|
5453
5451
|
offthreadVideoCacheSizeInBytes: config.offthreadVideoCacheSizeInBytes,
|
|
5454
5452
|
offthreadVideoThreads: config.offthreadVideoThreads
|
|
5455
5453
|
});
|
|
5456
|
-
const serializedResolvedProps =
|
|
5454
|
+
const serializedResolvedProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
5457
5455
|
data: composition.props,
|
|
5458
5456
|
indent: undefined,
|
|
5459
5457
|
staticBase: null
|
|
@@ -5493,6 +5491,7 @@ try {
|
|
|
5493
5491
|
numberOfGifLoops: config.numberOfGifLoops,
|
|
5494
5492
|
x264Preset: config.x264Preset,
|
|
5495
5493
|
gopSize: config.gopSize,
|
|
5494
|
+
proResBitsPerMacroblock: config.proResBitsPerMacroblock,
|
|
5496
5495
|
colorSpace: config.colorSpace,
|
|
5497
5496
|
jpegQuality: config.jpegQuality,
|
|
5498
5497
|
audioCodec: config.audioCodec,
|
|
@@ -5987,6 +5986,7 @@ var internalRenderMediaOnVercel = async (options) => {
|
|
|
5987
5986
|
numberOfGifLoops,
|
|
5988
5987
|
x264Preset,
|
|
5989
5988
|
gopSize,
|
|
5989
|
+
proResBitsPerMacroblock,
|
|
5990
5990
|
colorSpace = "default",
|
|
5991
5991
|
jpegQuality = 80,
|
|
5992
5992
|
audioCodec,
|
|
@@ -6039,6 +6039,7 @@ var internalRenderMediaOnVercel = async (options) => {
|
|
|
6039
6039
|
numberOfGifLoops: numberOfGifLoops ?? null,
|
|
6040
6040
|
x264Preset: x264Preset ?? null,
|
|
6041
6041
|
gopSize: gopSize ?? null,
|
|
6042
|
+
proResBitsPerMacroblock: proResBitsPerMacroblock ?? null,
|
|
6042
6043
|
colorSpace,
|
|
6043
6044
|
jpegQuality,
|
|
6044
6045
|
audioCodec: audioCodec ?? null,
|