@remotion/vercel 4.0.542 → 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 +2231 -2228
- package/dist/render-media-on-vercel.d.ts +1 -0
- package/package.json +4 -4
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,466 +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: "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
|
-
};
|
|
1901
|
-
var hiddenField = {
|
|
1902
|
-
type: "boolean",
|
|
1903
|
-
default: false,
|
|
1904
|
-
description: "Hidden"
|
|
1905
|
-
};
|
|
1906
|
-
var showInTimelineField = {
|
|
1907
|
-
type: "hidden"
|
|
1908
|
-
};
|
|
1909
|
-
var sequenceNameField = {
|
|
1910
|
-
type: "hidden"
|
|
1911
|
-
};
|
|
1912
|
-
var durationInFramesField = {
|
|
1913
|
-
type: "number",
|
|
1914
|
-
default: undefined,
|
|
1915
|
-
min: 1,
|
|
1916
|
-
step: 1,
|
|
1917
|
-
hiddenFromList: true
|
|
1918
|
-
};
|
|
1919
|
-
var fromField = {
|
|
1920
|
-
type: "number",
|
|
1921
|
-
default: 0,
|
|
1922
|
-
step: 1,
|
|
1923
|
-
hiddenFromList: true
|
|
1924
|
-
};
|
|
1925
|
-
var trimBeforeField = {
|
|
1926
|
-
type: "number",
|
|
1927
|
-
default: 0,
|
|
1928
|
-
min: 0,
|
|
1929
|
-
step: 1,
|
|
1930
|
-
hiddenFromList: true
|
|
1931
|
-
};
|
|
1932
|
-
var sequenceTimingSchema = {
|
|
1933
|
-
from: {
|
|
1934
|
-
...fromField,
|
|
1935
|
-
description: "From",
|
|
1936
|
-
hiddenFromList: false,
|
|
1937
|
-
keyframable: false
|
|
1938
|
-
},
|
|
1939
|
-
durationInFrames: {
|
|
1940
|
-
...durationInFramesField,
|
|
1941
|
-
description: "Duration",
|
|
1942
|
-
hiddenFromList: false,
|
|
1943
|
-
keyframable: false
|
|
1944
|
-
},
|
|
1945
|
-
trimBefore: {
|
|
1946
|
-
...trimBeforeField,
|
|
1947
|
-
description: "Trim before",
|
|
1948
|
-
hiddenFromList: false,
|
|
1949
|
-
keyframable: false
|
|
1905
|
+
static poly(n) {
|
|
1906
|
+
return (t) => t ** n;
|
|
1950
1907
|
}
|
|
1951
|
-
|
|
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
|
-
|
|
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;
|
|
1986
1972
|
}
|
|
1973
|
+
const t2 = u - 2.625 / 2.75;
|
|
1974
|
+
return 7.5625 * t2 * t2 + 0.984375;
|
|
1987
1975
|
}
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
durationInFrames: durationInFramesField,
|
|
1991
|
-
trimBefore: trimBeforeField,
|
|
1992
|
-
playbackRate: playbackRateField,
|
|
1993
|
-
freeze: freezeField,
|
|
1994
|
-
hidden: hiddenField,
|
|
1995
|
-
name: sequenceNameField,
|
|
1996
|
-
showInTimeline: showInTimelineField
|
|
1997
|
-
};
|
|
1998
|
-
var sequenceSchemaWithoutFrom = {
|
|
1999
|
-
...baseSchemaWithoutFrom,
|
|
2000
|
-
layout: sequenceSchema.layout
|
|
2001
|
-
};
|
|
2002
|
-
var sequenceSchemaDefaultLayoutNone = {
|
|
2003
|
-
...sequenceSchema,
|
|
2004
|
-
layout: {
|
|
2005
|
-
...sequenceSchema.layout,
|
|
2006
|
-
default: "none"
|
|
1976
|
+
static bezier(x1, y1, x2, y2) {
|
|
1977
|
+
return bezier(x1, y1, x2, y2);
|
|
2007
1978
|
}
|
|
2008
|
-
|
|
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
|
+
}
|
|
2009
1994
|
var NUMBER = "[-+]?\\\\d*\\\\.?\\\\d+";
|
|
2010
1995
|
var PERCENTAGE = NUMBER + "%";
|
|
2011
1996
|
function call(...args) {
|
|
@@ -2457,88 +2442,57 @@ function processColor(color) {
|
|
|
2457
2442
|
const normalizedColor = normalizeColor(color);
|
|
2458
2443
|
return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
|
|
2459
2444
|
}
|
|
2460
|
-
var
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
var defaultScaleValue = [1, 1, 1];
|
|
2469
|
-
var parseScaleString = (value) => {
|
|
2470
|
-
const parts = value.trim().split(/\\s+/);
|
|
2471
|
-
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
2472
|
-
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");
|
|
2473
2453
|
}
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
return null;
|
|
2454
|
+
if (typeof value !== "string") {
|
|
2455
|
+
throw new Error("Value must be a string, but is " + JSON.stringify(value));
|
|
2477
2456
|
}
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
const z = parsed[2] ?? 1;
|
|
2481
|
-
return [x, y, z];
|
|
2482
|
-
};
|
|
2483
|
-
var parseValidScaleValue = (value) => {
|
|
2484
|
-
if (typeof value === "number") {
|
|
2485
|
-
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");
|
|
2486
2459
|
}
|
|
2487
|
-
|
|
2488
|
-
|
|
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));
|
|
2489
2463
|
}
|
|
2490
|
-
|
|
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];
|
|
2491
2474
|
};
|
|
2492
|
-
var
|
|
2493
|
-
|
|
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;
|
|
2494
2480
|
};
|
|
2495
|
-
var
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
const normalizedZ = normalizeNumber(z);
|
|
2499
|
-
if (normalizedX === normalizedY && normalizedZ === 1) {
|
|
2500
|
-
return normalizedX;
|
|
2481
|
+
var getAbsoluteSrc = (relativeSrc) => {
|
|
2482
|
+
if (typeof window === "undefined") {
|
|
2483
|
+
return relativeSrc;
|
|
2501
2484
|
}
|
|
2502
|
-
if (
|
|
2503
|
-
return
|
|
2485
|
+
if (relativeSrc.startsWith("http://") || relativeSrc.startsWith("https://") || relativeSrc.startsWith("file://") || relativeSrc.startsWith("blob:") || relativeSrc.startsWith("data:")) {
|
|
2486
|
+
return relativeSrc;
|
|
2504
2487
|
}
|
|
2505
|
-
return
|
|
2488
|
+
return new URL(relativeSrc, document.baseURI).href;
|
|
2506
2489
|
};
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
frames,
|
|
2512
|
-
durationInFrames
|
|
2490
|
+
var getExpectedMediaFrameUncorrected = ({
|
|
2491
|
+
frame,
|
|
2492
|
+
playbackRate,
|
|
2493
|
+
startFrom
|
|
2513
2494
|
}) => {
|
|
2514
|
-
|
|
2515
|
-
throw new TypeError("The \`frames\` option must be an array of frame numbers.");
|
|
2516
|
-
}
|
|
2517
|
-
if (frames.length === 0) {
|
|
2518
|
-
throw new TypeError("The \`frames\` option must contain at least one frame.");
|
|
2519
|
-
}
|
|
2520
|
-
for (const frame of frames) {
|
|
2521
|
-
if (typeof frame !== "number") {
|
|
2522
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only numbers, but got \${typeof frame}.\`);
|
|
2523
|
-
}
|
|
2524
|
-
if (!Number.isFinite(frame)) {
|
|
2525
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only finite numbers, but got \${frame}.\`);
|
|
2526
|
-
}
|
|
2527
|
-
if (!Number.isInteger(frame)) {
|
|
2528
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only integers, but got \${frame}.\`);
|
|
2529
|
-
}
|
|
2530
|
-
if (frame < 0) {
|
|
2531
|
-
throw new TypeError(\`The \\\`frames\\\` option must contain only non-negative numbers, but got \${frame}.\`);
|
|
2532
|
-
}
|
|
2533
|
-
if (durationInFrames !== null && frame >= durationInFrames) {
|
|
2534
|
-
throw new RangeError(\`Frame \${frame} is out of range, must be between 0 and \${durationInFrames - 1}.\`);
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
const uniqueFrames = new Set(frames);
|
|
2538
|
-
if (uniqueFrames.size !== frames.length) {
|
|
2539
|
-
throw new TypeError("The \`frames\` option must not contain duplicate frames.");
|
|
2540
|
-
}
|
|
2541
|
-
return [...frames].sort((a, b) => a - b);
|
|
2495
|
+
return interpolate2(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
2542
2496
|
};
|
|
2543
2497
|
var validCodecs = [
|
|
2544
2498
|
"h264",
|
|
@@ -2565,77 +2519,123 @@ function validateCodec(defaultCodec, location, name) {
|
|
|
2565
2519
|
throw new Error(\`The "\${name}" prop \${location} must be one of \${validCodecs.join(", ")}, but you passed \${defaultCodec}.\`);
|
|
2566
2520
|
}
|
|
2567
2521
|
}
|
|
2568
|
-
var
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
}
|
|
2575
|
-
if (Array.isArray(defaultProps)) {
|
|
2576
|
-
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
2577
|
-
}
|
|
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)}\`;
|
|
2578
2529
|
};
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
if (
|
|
2584
|
-
|
|
2585
|
-
}
|
|
2586
|
-
if (!Number.isFinite(amount)) {
|
|
2587
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
2588
|
-
}
|
|
2589
|
-
if (amount % 1 !== 0) {
|
|
2590
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
2591
|
-
}
|
|
2592
|
-
if (amount <= 0) {
|
|
2593
|
-
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;
|
|
2594
2536
|
}
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
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;
|
|
2600
2552
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
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;
|
|
2603
2571
|
}
|
|
2604
|
-
|
|
2605
|
-
|
|
2572
|
+
const parsed = parts.map((part) => Number(part));
|
|
2573
|
+
if (!parsed.every((part) => Number.isFinite(part))) {
|
|
2574
|
+
return null;
|
|
2606
2575
|
}
|
|
2607
|
-
|
|
2608
|
-
|
|
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;
|
|
2609
2584
|
}
|
|
2610
|
-
if (
|
|
2611
|
-
|
|
2585
|
+
if (typeof value === "string") {
|
|
2586
|
+
return parseScaleString(value);
|
|
2612
2587
|
}
|
|
2613
|
-
|
|
2614
|
-
var getExpectedMediaFrameUncorrected = ({
|
|
2615
|
-
frame,
|
|
2616
|
-
playbackRate,
|
|
2617
|
-
startFrom
|
|
2618
|
-
}) => {
|
|
2619
|
-
return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
2588
|
+
return null;
|
|
2620
2589
|
};
|
|
2621
|
-
var
|
|
2622
|
-
|
|
2623
|
-
|
|
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;
|
|
2624
2599
|
}
|
|
2625
|
-
if (
|
|
2626
|
-
return
|
|
2600
|
+
if (normalizedZ === 1) {
|
|
2601
|
+
return \`\${normalizedX} \${normalizedY}\`;
|
|
2627
2602
|
}
|
|
2628
|
-
return
|
|
2603
|
+
return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
|
|
2629
2604
|
};
|
|
2630
|
-
var
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
currentTime,
|
|
2634
|
-
toneMapped
|
|
2605
|
+
var validateSelectedFrames = ({
|
|
2606
|
+
frames,
|
|
2607
|
+
durationInFrames
|
|
2635
2608
|
}) => {
|
|
2636
|
-
|
|
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);
|
|
2637
2637
|
};
|
|
2638
|
-
var
|
|
2638
|
+
var NoReactInternals2 = {
|
|
2639
2639
|
validatePreferredEffectBackend,
|
|
2640
2640
|
DEFAULT_PREMOUNT_IN_SECONDS,
|
|
2641
2641
|
DEFAULT_STUDIO_PREMOUNT_IN_SECONDS,
|
|
@@ -2685,7 +2685,7 @@ var noop = () => {
|
|
|
2685
2685
|
return;
|
|
2686
2686
|
};
|
|
2687
2687
|
try {
|
|
2688
|
-
const serializedInputProps =
|
|
2688
|
+
const serializedInputProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
2689
2689
|
data: config.inputProps,
|
|
2690
2690
|
indent: undefined,
|
|
2691
2691
|
staticBase: null
|
|
@@ -2730,653 +2730,717 @@ try {
|
|
|
2730
2730
|
mediaCacheSizeInBytes: config.mediaCacheSizeInBytes,
|
|
2731
2731
|
preferredEffectBackend: config.preferredEffectBackend,
|
|
2732
2732
|
offthreadVideoCacheSizeInBytes: config.offthreadVideoCacheSizeInBytes,
|
|
2733
|
-
offthreadVideoThreads: config.offthreadVideoThreads
|
|
2734
|
-
});
|
|
2735
|
-
const serializedResolvedProps =
|
|
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);
|
|
2785
|
-
}
|
|
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/no-react.mjs
|
|
2796
|
-
var validatePreferredEffectBackend = (value) => {
|
|
2797
|
-
if (value !== "auto" && value !== "webgpu" && value !== "webgl2" && value !== "2d") {
|
|
2798
|
-
throw new TypeError(\`preferredEffectBackend must be "auto", "webgpu", "webgl2" or "2d", got \${String(value)}\`);
|
|
2799
|
-
}
|
|
2800
|
-
return value;
|
|
2801
|
-
};
|
|
2802
|
-
var evaluateSourceNumericValue = (expression, config) => {
|
|
2803
|
-
if (typeof expression === "number") {
|
|
2804
|
-
return expression;
|
|
2805
|
-
}
|
|
2806
|
-
if (expression.type === "literal") {
|
|
2807
|
-
return expression.value;
|
|
2808
|
-
}
|
|
2809
|
-
if (expression.type === "binary") {
|
|
2810
|
-
const left = evaluateSourceNumericValue(expression.left, config);
|
|
2811
|
-
const right = evaluateSourceNumericValue(expression.right, config);
|
|
2812
|
-
switch (expression.operator) {
|
|
2813
|
-
case "+":
|
|
2814
|
-
return left + right;
|
|
2815
|
-
case "-":
|
|
2816
|
-
return left - right;
|
|
2817
|
-
case "*":
|
|
2818
|
-
return left * right;
|
|
2819
|
-
case "/":
|
|
2820
|
-
return left / right;
|
|
2821
|
-
default:
|
|
2822
|
-
throw new Error("Unknown source expression operator");
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
const value = expression.binding.type === "constant" ? expression.binding.value : config?.[expression.binding.field] ?? NaN;
|
|
2826
|
-
if (expression.type === "video-config-multiplication") {
|
|
2827
|
-
return value * expression.multiplier;
|
|
2828
|
-
}
|
|
2829
|
-
if (expression.type === "video-config-subtraction") {
|
|
2830
|
-
return value - expression.subtrahend;
|
|
2831
|
-
}
|
|
2832
|
-
return value;
|
|
2833
|
-
};
|
|
2834
|
-
var evaluatedProps = new WeakMap;
|
|
2835
|
-
var evaluateSourcePropStatuses = (props, config) => {
|
|
2836
|
-
const configKey = config === null ? "" : \`\${config.durationInFrames}:\${config.fps}:\${config.width}:\${config.height}\`;
|
|
2837
|
-
const cached = evaluatedProps.get(props) ?? new Map;
|
|
2838
|
-
const existing = cached.get(configKey);
|
|
2839
|
-
if (existing)
|
|
2840
|
-
return existing;
|
|
2841
|
-
const result = Object.fromEntries(Object.entries(props).map(([key, status]) => {
|
|
2842
|
-
if (status.status === "computed") {
|
|
2843
|
-
return [key, status];
|
|
2844
|
-
}
|
|
2845
|
-
const adjustment = status.keyframeDisplayOffsetAdjustment === null ? null : evaluateSourceNumericValue(status.keyframeDisplayOffsetAdjustment, config);
|
|
2846
|
-
const rate = evaluateSourceNumericValue(status.keyframePlaybackRateAdjustment ?? 1, config);
|
|
2847
|
-
if (adjustment !== null && !Number.isFinite(adjustment) || !Number.isFinite(rate) || rate <= 0) {
|
|
2848
|
-
return [key, { status: "computed" }];
|
|
2849
|
-
}
|
|
2850
|
-
const timing = {
|
|
2851
|
-
keyframeDisplayOffsetAdjustment: adjustment,
|
|
2852
|
-
...status.keyframePlaybackRateAdjustment === undefined ? {} : { keyframePlaybackRateAdjustment: rate }
|
|
2853
|
-
};
|
|
2854
|
-
if (status.status === "static") {
|
|
2855
|
-
const value = status.numericExpression === undefined ? status.codeValue : evaluateSourceNumericValue(status.numericExpression, config);
|
|
2856
|
-
return [
|
|
2857
|
-
key,
|
|
2858
|
-
status.numericExpression !== undefined && !Number.isFinite(value) ? { status: "computed" } : { ...status, ...timing, codeValue: value }
|
|
2859
|
-
];
|
|
2860
|
-
}
|
|
2861
|
-
const keyframes = status.keyframes.map((keyframe) => ({
|
|
2862
|
-
...keyframe,
|
|
2863
|
-
frame: evaluateSourceNumericValue(keyframe.frame, config)
|
|
2864
|
-
}));
|
|
2865
|
-
if (keyframes.some((keyframe, index) => !Number.isFinite(keyframe.frame) || index > 0 && keyframe.frame <= keyframes[index - 1].frame)) {
|
|
2866
|
-
return [key, { status: "computed" }];
|
|
2867
|
-
}
|
|
2868
|
-
return [key, { ...status, ...timing, keyframes }];
|
|
2869
|
-
}));
|
|
2870
|
-
cached.set(configKey, result);
|
|
2871
|
-
if (cached.size > 8)
|
|
2872
|
-
cached.delete(cached.keys().next().value);
|
|
2873
|
-
evaluatedProps.set(props, cached);
|
|
2874
|
-
return result;
|
|
2875
|
-
};
|
|
2876
|
-
var DEFAULT_SEQUENCE_ACTIVITY_LIMIT = Infinity;
|
|
2877
|
-
var NEWTON_ITERATIONS = 4;
|
|
2878
|
-
var NEWTON_MIN_SLOPE = 0.001;
|
|
2879
|
-
var SUBDIVISION_PRECISION = 0.0000001;
|
|
2880
|
-
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
2881
|
-
var kSplineTableSize = 11;
|
|
2882
|
-
var kSampleStepSize = 1 / (kSplineTableSize - 1);
|
|
2883
|
-
var float32ArraySupported = typeof Float32Array === "function";
|
|
2884
|
-
function a(aA1, aA2) {
|
|
2885
|
-
return 1 - 3 * aA2 + 3 * aA1;
|
|
2886
|
-
}
|
|
2887
|
-
function b(aA1, aA2) {
|
|
2888
|
-
return 3 * aA2 - 6 * aA1;
|
|
2889
|
-
}
|
|
2890
|
-
function c(aA1) {
|
|
2891
|
-
return 3 * aA1;
|
|
2892
|
-
}
|
|
2893
|
-
function calcBezier(aT, aA1, aA2) {
|
|
2894
|
-
return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
|
|
2895
|
-
}
|
|
2896
|
-
function getSlope(aT, aA1, aA2) {
|
|
2897
|
-
return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
|
|
2898
|
-
}
|
|
2899
|
-
function binarySubdivide({
|
|
2900
|
-
aX,
|
|
2901
|
-
_aA,
|
|
2902
|
-
_aB,
|
|
2903
|
-
mX1,
|
|
2904
|
-
mX2
|
|
2905
|
-
}) {
|
|
2906
|
-
let currentX;
|
|
2907
|
-
let currentT;
|
|
2908
|
-
let i = 0;
|
|
2909
|
-
let aA = _aA;
|
|
2910
|
-
let aB = _aB;
|
|
2911
|
-
do {
|
|
2912
|
-
currentT = aA + (aB - aA) / 2;
|
|
2913
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
2914
|
-
if (currentX > 0) {
|
|
2915
|
-
aB = currentT;
|
|
2916
|
-
} else {
|
|
2917
|
-
aA = currentT;
|
|
2918
|
-
}
|
|
2919
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
2920
|
-
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);
|
|
2921
2785
|
}
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
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);
|
|
2933
2798
|
}
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
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);
|
|
2943
2834
|
}
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
const initialSlope = getSlope(guessForT, mX1, mX2);
|
|
2955
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
2956
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
2957
|
-
}
|
|
2958
|
-
if (initialSlope === 0) {
|
|
2959
|
-
return guessForT;
|
|
2960
|
-
}
|
|
2961
|
-
return binarySubdivide({
|
|
2962
|
-
aX,
|
|
2963
|
-
_aA: intervalStart,
|
|
2964
|
-
_aB: intervalStart + kSampleStepSize,
|
|
2965
|
-
mX1,
|
|
2966
|
-
mX2
|
|
2967
|
-
});
|
|
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;
|
|
2968
2845
|
}
|
|
2969
|
-
return
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
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, ""));
|
|
2976
2852
|
}
|
|
2977
|
-
if (
|
|
2978
|
-
return
|
|
2853
|
+
if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
|
|
2854
|
+
return resolveFileTokenToUrl(value);
|
|
2979
2855
|
}
|
|
2980
|
-
return
|
|
2981
|
-
};
|
|
2982
|
-
}
|
|
2983
|
-
var validateFrame = ({
|
|
2984
|
-
allowFloats,
|
|
2985
|
-
durationInFrames,
|
|
2986
|
-
frame
|
|
2987
|
-
}) => {
|
|
2988
|
-
if (typeof frame === "undefined") {
|
|
2989
|
-
throw new TypeError(\`Argument missing for parameter "frame"\`);
|
|
2990
|
-
}
|
|
2991
|
-
if (typeof frame !== "number") {
|
|
2992
|
-
throw new TypeError(\`Argument passed for "frame" is not a number: \${frame}\`);
|
|
2993
|
-
}
|
|
2994
|
-
if (!Number.isFinite(frame)) {
|
|
2995
|
-
throw new RangeError(\`Frame \${frame} is not finite\`);
|
|
2996
|
-
}
|
|
2997
|
-
if (frame % 1 !== 0 && !allowFloats) {
|
|
2998
|
-
throw new RangeError(\`Argument for frame must be an integer, but got \${frame}\`);
|
|
2999
|
-
}
|
|
3000
|
-
if (frame < 0 && frame < -durationInFrames) {
|
|
3001
|
-
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the lowest frame that can be rendered is \${-durationInFrames}\`);
|
|
3002
|
-
}
|
|
3003
|
-
if (frame > durationInFrames - 1) {
|
|
3004
|
-
throw new RangeError(\`Cannot use frame \${frame}: Duration of composition is \${durationInFrames}, therefore the highest frame that can be rendered is \${durationInFrames - 1}\`);
|
|
3005
|
-
}
|
|
2856
|
+
return value;
|
|
2857
|
+
});
|
|
3006
2858
|
};
|
|
3007
|
-
function
|
|
3008
|
-
if (typeof
|
|
3009
|
-
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}\`);
|
|
3010
2862
|
}
|
|
3011
|
-
if (
|
|
3012
|
-
throw new
|
|
2863
|
+
if (isNaN(amount)) {
|
|
2864
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must not be NaN, but is NaN.\`);
|
|
3013
2865
|
}
|
|
3014
|
-
if (
|
|
3015
|
-
throw new
|
|
2866
|
+
if (!Number.isFinite(amount)) {
|
|
2867
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
3016
2868
|
}
|
|
3017
|
-
if (
|
|
3018
|
-
throw new TypeError(\`"
|
|
2869
|
+
if (amount % 1 !== 0) {
|
|
2870
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
3019
2871
|
}
|
|
3020
|
-
if (
|
|
3021
|
-
throw new TypeError(\`The
|
|
2872
|
+
if (amount <= 0) {
|
|
2873
|
+
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be positive, but got \${amount}.\`);
|
|
3022
2874
|
}
|
|
3023
2875
|
}
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
if (typeof dur !== "number") {
|
|
3029
|
-
throw new TypeError(\`A "duration" of a spring must be a "number" but is "\${typeof dur}"\`);
|
|
3030
|
-
}
|
|
3031
|
-
if (Number.isNaN(dur)) {
|
|
3032
|
-
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
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.\`);
|
|
3033
2880
|
}
|
|
3034
|
-
if (
|
|
3035
|
-
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}\`);
|
|
3036
2883
|
}
|
|
3037
|
-
if (
|
|
3038
|
-
throw new TypeError(
|
|
2884
|
+
if (durationInFrames <= 0) {
|
|
2885
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be positive, but got \${durationInFrames}.\`);
|
|
3039
2886
|
}
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
damping: 10,
|
|
3043
|
-
mass: 1,
|
|
3044
|
-
stiffness: 100,
|
|
3045
|
-
overshootClamping: false
|
|
3046
|
-
};
|
|
3047
|
-
var advanceCache = {};
|
|
3048
|
-
function advance({
|
|
3049
|
-
animation,
|
|
3050
|
-
now,
|
|
3051
|
-
config
|
|
3052
|
-
}) {
|
|
3053
|
-
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
3054
|
-
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
3055
|
-
if (config.damping <= 0) {
|
|
3056
|
-
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
2887
|
+
if (!Number.isFinite(durationInFrames)) {
|
|
2888
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be finite, but got \${durationInFrames}.\`);
|
|
3057
2889
|
}
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
const k = config.stiffness;
|
|
3061
|
-
const cacheKey = [
|
|
3062
|
-
toValue,
|
|
3063
|
-
lastTimestamp,
|
|
3064
|
-
current,
|
|
3065
|
-
velocity,
|
|
3066
|
-
c,
|
|
3067
|
-
m,
|
|
3068
|
-
k,
|
|
3069
|
-
now
|
|
3070
|
-
].join("-");
|
|
3071
|
-
if (advanceCache[cacheKey]) {
|
|
3072
|
-
return advanceCache[cacheKey];
|
|
2890
|
+
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
2891
|
+
throw new TypeError(\`The "durationInFrames" prop \${component} must be an integer, but got \${durationInFrames}.\`);
|
|
3073
2892
|
}
|
|
3074
|
-
const v0 = -velocity;
|
|
3075
|
-
const x0 = toValue - current;
|
|
3076
|
-
const zeta = c / (2 * Math.sqrt(k * m));
|
|
3077
|
-
const omega0 = Math.sqrt(k / m);
|
|
3078
|
-
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
3079
|
-
const t = deltaTime / 1000;
|
|
3080
|
-
const sin1 = Math.sin(omega1 * t);
|
|
3081
|
-
const cos1 = Math.cos(omega1 * t);
|
|
3082
|
-
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
3083
|
-
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
3084
|
-
const underDampedPosition = toValue - underDampedFrag1;
|
|
3085
|
-
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
3086
|
-
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
3087
|
-
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
3088
|
-
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
3089
|
-
const animationNode = {
|
|
3090
|
-
toValue,
|
|
3091
|
-
prevPosition: current,
|
|
3092
|
-
lastTimestamp: now,
|
|
3093
|
-
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
3094
|
-
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
3095
|
-
};
|
|
3096
|
-
advanceCache[cacheKey] = animationNode;
|
|
3097
|
-
return animationNode;
|
|
3098
2893
|
}
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
fps,
|
|
3103
|
-
config = {}
|
|
3104
|
-
}) {
|
|
3105
|
-
const from = 0;
|
|
3106
|
-
const to = 1;
|
|
3107
|
-
const resolvedConfig = {
|
|
3108
|
-
damping: config.damping ?? defaultSpringConfig.damping,
|
|
3109
|
-
mass: config.mass ?? defaultSpringConfig.mass,
|
|
3110
|
-
stiffness: config.stiffness ?? defaultSpringConfig.stiffness,
|
|
3111
|
-
overshootClamping: config.overshootClamping ?? defaultSpringConfig.overshootClamping
|
|
3112
|
-
};
|
|
3113
|
-
const configKey = [
|
|
3114
|
-
fps,
|
|
3115
|
-
resolvedConfig.damping,
|
|
3116
|
-
resolvedConfig.mass,
|
|
3117
|
-
resolvedConfig.overshootClamping,
|
|
3118
|
-
resolvedConfig.stiffness
|
|
3119
|
-
].join("-");
|
|
3120
|
-
const cacheKey = \`\${frame}-\${configKey}\`;
|
|
3121
|
-
if (calculationCache[cacheKey]) {
|
|
3122
|
-
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}\`);
|
|
3123
2897
|
}
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
const previousAnimation = previousFrame >= 0 ? calculationCache[\`\${previousFrame}-\${configKey}\`] : undefined;
|
|
3127
|
-
let animation = previousAnimation ?? {
|
|
3128
|
-
lastTimestamp: 0,
|
|
3129
|
-
current: from,
|
|
3130
|
-
toValue: to,
|
|
3131
|
-
velocity: 0,
|
|
3132
|
-
prevPosition: 0
|
|
3133
|
-
};
|
|
3134
|
-
const unevenRest = frameClamped % 1;
|
|
3135
|
-
const startFrame = previousAnimation ? previousFrame + 1 : 0;
|
|
3136
|
-
for (let f = startFrame;f <= Math.floor(frameClamped); f++) {
|
|
3137
|
-
const time = f / fps * 1000;
|
|
3138
|
-
animation = advance({
|
|
3139
|
-
animation,
|
|
3140
|
-
now: time,
|
|
3141
|
-
config: resolvedConfig
|
|
3142
|
-
});
|
|
2898
|
+
if (!Number.isFinite(fps)) {
|
|
2899
|
+
throw new Error(\`"fps" must be a finite, but you passed \${fps} \${location}\`);
|
|
3143
2900
|
}
|
|
3144
|
-
if (
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
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\`);
|
|
3150
2909
|
}
|
|
3151
|
-
calculationCache[cacheKey] = animation;
|
|
3152
|
-
return animation;
|
|
3153
2910
|
}
|
|
3154
|
-
var
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
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;
|
|
3162
2918
|
}
|
|
3163
|
-
if (
|
|
3164
|
-
|
|
2919
|
+
if (typeof defaultProps !== "object") {
|
|
2920
|
+
throw new Error(\`"\${name}" must be an object, but you passed a value of type \${typeof defaultProps}\`);
|
|
3165
2921
|
}
|
|
3166
|
-
if (
|
|
3167
|
-
|
|
2922
|
+
if (Array.isArray(defaultProps)) {
|
|
2923
|
+
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
3168
2924
|
}
|
|
3169
|
-
|
|
3170
|
-
|
|
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)}.\`);
|
|
3171
2932
|
}
|
|
3172
|
-
|
|
3173
|
-
|
|
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
|
|
3174
2970
|
}
|
|
3175
|
-
|
|
3176
|
-
|
|
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"
|
|
3177
3002
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
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
|
|
3188
3045
|
}
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
frame,
|
|
3196
|
-
config
|
|
3197
|
-
});
|
|
3198
|
-
};
|
|
3199
|
-
let animation = calc();
|
|
3200
|
-
const calcDifference = () => {
|
|
3201
|
-
return Math.abs(animation.current - animation.toValue);
|
|
3202
|
-
};
|
|
3203
|
-
let difference = calcDifference();
|
|
3204
|
-
while (difference >= threshold) {
|
|
3205
|
-
frame++;
|
|
3206
|
-
animation = calc();
|
|
3207
|
-
difference = calcDifference();
|
|
3046
|
+
};
|
|
3047
|
+
var backgroundSchema = {
|
|
3048
|
+
"style.backgroundColor": {
|
|
3049
|
+
type: "color",
|
|
3050
|
+
default: "transparent",
|
|
3051
|
+
description: "Color"
|
|
3208
3052
|
}
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
i = 0;
|
|
3216
|
-
finishedFrame = frame + 1;
|
|
3217
|
-
}
|
|
3053
|
+
};
|
|
3054
|
+
var svgColorSchema = {
|
|
3055
|
+
color: {
|
|
3056
|
+
type: "color",
|
|
3057
|
+
default: undefined,
|
|
3058
|
+
description: "Current color"
|
|
3218
3059
|
}
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
validateFrame({
|
|
3235
|
-
frame: passedFrame,
|
|
3236
|
-
durationInFrames: Infinity,
|
|
3237
|
-
allowFloats: true
|
|
3238
|
-
});
|
|
3239
|
-
validateFps(fps, "to spring()", false);
|
|
3240
|
-
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
3241
|
-
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring({
|
|
3242
|
-
fps,
|
|
3243
|
-
config,
|
|
3244
|
-
threshold: durationRestThreshold
|
|
3245
|
-
}) : undefined;
|
|
3246
|
-
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
3247
|
-
get: () => naturalDuration
|
|
3248
|
-
} : {
|
|
3249
|
-
get: () => {
|
|
3250
|
-
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
3251
|
-
}
|
|
3252
|
-
};
|
|
3253
|
-
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
3254
|
-
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
3255
|
-
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
3256
|
-
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
3257
|
-
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
|
|
3258
3075
|
}
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
}
|
|
3268
|
-
var
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
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
|
|
3275
3102
|
}
|
|
3276
|
-
|
|
3277
|
-
|
|
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
|
|
3278
3147
|
}
|
|
3279
|
-
|
|
3280
|
-
|
|
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
|
+
}
|
|
3281
3243
|
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
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"
|
|
3285
3263
|
}
|
|
3286
|
-
|
|
3287
|
-
|
|
3264
|
+
};
|
|
3265
|
+
var evaluateSourceNumericValue = (expression, config) => {
|
|
3266
|
+
if (typeof expression === "number") {
|
|
3267
|
+
return expression;
|
|
3288
3268
|
}
|
|
3289
|
-
|
|
3290
|
-
return
|
|
3269
|
+
if (expression.type === "literal") {
|
|
3270
|
+
return expression.value;
|
|
3291
3271
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
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
|
+
}
|
|
3294
3287
|
}
|
|
3295
|
-
|
|
3296
|
-
|
|
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;
|
|
3297
3291
|
}
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
return 1 - Math.sqrt(1 - u * u);
|
|
3292
|
+
if (expression.type === "video-config-subtraction") {
|
|
3293
|
+
return value - expression.subtrahend;
|
|
3301
3294
|
}
|
|
3302
|
-
|
|
3303
|
-
|
|
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;
|
|
3304
3393
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
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");
|
|
3308
3399
|
}
|
|
3309
|
-
|
|
3310
|
-
|
|
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
|
+
}
|
|
3311
3405
|
}
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
return spring({
|
|
3336
|
-
fps: springEasingDurationInFrames,
|
|
3337
|
-
frame: t * springEasingDurationInFrames,
|
|
3338
|
-
config,
|
|
3339
|
-
durationInFrames: springEasingDurationInFrames,
|
|
3340
|
-
durationRestThreshold
|
|
3341
|
-
});
|
|
3342
|
-
};
|
|
3343
|
-
return Object.assign(easing, {
|
|
3344
|
-
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
|
|
3345
3429
|
});
|
|
3346
3430
|
}
|
|
3347
|
-
|
|
3348
|
-
const
|
|
3349
|
-
if (
|
|
3350
|
-
return
|
|
3431
|
+
return function(x) {
|
|
3432
|
+
const clampedX = Math.min(1, Math.max(0, x));
|
|
3433
|
+
if (mX1 === mY1 && mX2 === mY2) {
|
|
3434
|
+
return clampedX;
|
|
3351
3435
|
}
|
|
3352
|
-
if (
|
|
3353
|
-
|
|
3354
|
-
return 7.5625 * t2_ * t2_ + 0.75;
|
|
3436
|
+
if (clampedX === 0) {
|
|
3437
|
+
return 0;
|
|
3355
3438
|
}
|
|
3356
|
-
if (
|
|
3357
|
-
|
|
3358
|
-
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
3439
|
+
if (clampedX === 1) {
|
|
3440
|
+
return 1;
|
|
3359
3441
|
}
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
}
|
|
3363
|
-
static bezier(x1, y1, x2, y2) {
|
|
3364
|
-
return bezier(x1, y1, x2, y2);
|
|
3365
|
-
}
|
|
3366
|
-
static in(easing) {
|
|
3367
|
-
return easing;
|
|
3368
|
-
}
|
|
3369
|
-
static out(easing) {
|
|
3370
|
-
return (t) => 1 - easing(1 - t);
|
|
3371
|
-
}
|
|
3372
|
-
static inOut(easing) {
|
|
3373
|
-
return (t) => {
|
|
3374
|
-
if (t < 0.5) {
|
|
3375
|
-
return easing(t * 2) / 2;
|
|
3376
|
-
}
|
|
3377
|
-
return 1 - easing((1 - t) * 2) / 2;
|
|
3378
|
-
};
|
|
3379
|
-
}
|
|
3442
|
+
return calcBezier(getTForX(clampedX), mY1, mY2);
|
|
3443
|
+
};
|
|
3380
3444
|
}
|
|
3381
3445
|
var normalizeNumber = (value) => {
|
|
3382
3446
|
return Math.round(value * 1e6) / 1e6;
|
|
@@ -4008,7 +4072,7 @@ var interpolateDiscreteValue = ({
|
|
|
4008
4072
|
if (resolveEasingForSegment({
|
|
4009
4073
|
easing: options?.easing,
|
|
4010
4074
|
segmentIndex
|
|
4011
|
-
}) !==
|
|
4075
|
+
}) !== Easing2.step1) {
|
|
4012
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");
|
|
4013
4077
|
}
|
|
4014
4078
|
}
|
|
@@ -4088,7 +4152,7 @@ function checkInfiniteRange(name, arr) {
|
|
|
4088
4152
|
}
|
|
4089
4153
|
}
|
|
4090
4154
|
}
|
|
4091
|
-
function
|
|
4155
|
+
function assertValidInterpolateEasingOption2(easing, inputRangeLength) {
|
|
4092
4156
|
if (easing === undefined) {
|
|
4093
4157
|
return;
|
|
4094
4158
|
}
|
|
@@ -4105,7 +4169,7 @@ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
|
|
|
4105
4169
|
}
|
|
4106
4170
|
}
|
|
4107
4171
|
}
|
|
4108
|
-
function
|
|
4172
|
+
function assertValidInterpolatePosterizeOption2(posterize) {
|
|
4109
4173
|
if (posterize === undefined) {
|
|
4110
4174
|
return;
|
|
4111
4175
|
}
|
|
@@ -4125,7 +4189,7 @@ function assertValidInterpolateOutputType(outputType) {
|
|
|
4125
4189
|
}
|
|
4126
4190
|
throw new Error(\`outputType must be "font-weight", "scale", "translate", "rotate", or "transform-origin", but got \${String(outputType)}\`);
|
|
4127
4191
|
}
|
|
4128
|
-
function
|
|
4192
|
+
function interpolate2(input, inputRange, outputRange, options) {
|
|
4129
4193
|
if (typeof input === "undefined") {
|
|
4130
4194
|
throw new Error("input can not be undefined");
|
|
4131
4195
|
}
|
|
@@ -4140,8 +4204,8 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
4140
4204
|
}
|
|
4141
4205
|
checkInfiniteRange("inputRange", inputRange);
|
|
4142
4206
|
checkValidInputRange(inputRange);
|
|
4143
|
-
|
|
4144
|
-
|
|
4207
|
+
assertValidInterpolateEasingOption2(options?.easing, inputRange.length);
|
|
4208
|
+
assertValidInterpolatePosterizeOption2(options?.posterize);
|
|
4145
4209
|
assertValidInterpolateOutputOption(options?.output);
|
|
4146
4210
|
assertValidInterpolateOutputType(options?.outputType);
|
|
4147
4211
|
if (typeof input !== "number") {
|
|
@@ -4224,466 +4288,387 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
4224
4288
|
checkInfiniteRange("outputRange", outputRange);
|
|
4225
4289
|
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
4226
4290
|
}
|
|
4227
|
-
var
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
4232
|
-
throw new TypeError(\`defaultPremountInSeconds must be a finite, non-negative number, but got \${String(value)}.\`);
|
|
4233
|
-
}
|
|
4234
|
-
};
|
|
4235
|
-
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
4236
|
-
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
4237
|
-
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
4238
|
-
var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
|
|
4239
|
-
var findPropsToDelete = ({
|
|
4240
|
-
schema,
|
|
4241
|
-
key,
|
|
4242
|
-
value
|
|
4291
|
+
var validateFrame = ({
|
|
4292
|
+
allowFloats,
|
|
4293
|
+
durationInFrames,
|
|
4294
|
+
frame
|
|
4243
4295
|
}) => {
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
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"\`);
|
|
4247
4298
|
}
|
|
4248
|
-
if (typeof
|
|
4249
|
-
throw new
|
|
4299
|
+
if (typeof frame !== "number") {
|
|
4300
|
+
throw new TypeError(\`Argument passed for "frame" is not a number: \${frame}\`);
|
|
4250
4301
|
}
|
|
4251
|
-
if (
|
|
4252
|
-
throw new
|
|
4302
|
+
if (!Number.isFinite(frame)) {
|
|
4303
|
+
throw new RangeError(\`Frame \${frame} is not finite\`);
|
|
4253
4304
|
}
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
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}\`);
|
|
4257
4307
|
}
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
for (const variant of otherVariants) {
|
|
4261
|
-
const otherVariant = fieldSchema.variants[variant];
|
|
4262
|
-
const keys = Object.keys(otherVariant);
|
|
4263
|
-
for (const k of keys) {
|
|
4264
|
-
otherKeys.add(k);
|
|
4265
|
-
}
|
|
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}\`);
|
|
4266
4310
|
}
|
|
4267
|
-
|
|
4268
|
-
};
|
|
4269
|
-
var registeredFontFaces = [];
|
|
4270
|
-
var fontDataByUrl = new Map;
|
|
4271
|
-
var fetchFontData = (fontUrl) => {
|
|
4272
|
-
const cached = fontDataByUrl.get(fontUrl);
|
|
4273
|
-
if (cached) {
|
|
4274
|
-
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}\`);
|
|
4275
4313
|
}
|
|
4276
|
-
const promise = fetch(fontUrl).then((response) => {
|
|
4277
|
-
if (!response.ok) {
|
|
4278
|
-
throw new Error(\`Failed to load font \${JSON.stringify(fontUrl)}: \${response.status} \${response.statusText}\`);
|
|
4279
|
-
}
|
|
4280
|
-
return response.arrayBuffer();
|
|
4281
|
-
}).catch((error) => {
|
|
4282
|
-
fontDataByUrl.delete(fontUrl);
|
|
4283
|
-
throw error;
|
|
4284
|
-
});
|
|
4285
|
-
fontDataByUrl.set(fontUrl, promise);
|
|
4286
|
-
return promise;
|
|
4287
4314
|
};
|
|
4288
|
-
var
|
|
4289
|
-
if (
|
|
4315
|
+
var validateSpringDuration = (dur) => {
|
|
4316
|
+
if (typeof dur === "undefined") {
|
|
4290
4317
|
return;
|
|
4291
4318
|
}
|
|
4292
|
-
|
|
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
|
-
|
|
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");
|
|
4468
|
+
}
|
|
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);
|
|
4332
4479
|
}
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
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();
|
|
4343
4499
|
}
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
return resolveFileTokenToUrl(value);
|
|
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;
|
|
4353
4508
|
}
|
|
4354
|
-
return value;
|
|
4355
|
-
});
|
|
4356
|
-
};
|
|
4357
|
-
var transformSchema = {
|
|
4358
|
-
"style.transformOrigin": {
|
|
4359
|
-
type: "transform-origin",
|
|
4360
|
-
step: 1,
|
|
4361
|
-
default: "50% 50%",
|
|
4362
|
-
description: "Origin"
|
|
4363
|
-
},
|
|
4364
|
-
"style.translate": {
|
|
4365
|
-
type: "translate",
|
|
4366
|
-
step: 1,
|
|
4367
|
-
default: "0px 0px",
|
|
4368
|
-
description: "Offset"
|
|
4369
|
-
},
|
|
4370
|
-
"style.scale": {
|
|
4371
|
-
type: "scale",
|
|
4372
|
-
max: 100,
|
|
4373
|
-
step: 0.01,
|
|
4374
|
-
default: 1,
|
|
4375
|
-
description: "Scale",
|
|
4376
|
-
defaultKeyframeOutput: "perceptual-scale"
|
|
4377
|
-
},
|
|
4378
|
-
"style.rotate": {
|
|
4379
|
-
type: "rotation-css",
|
|
4380
|
-
step: 1,
|
|
4381
|
-
default: "0deg",
|
|
4382
|
-
description: "Rotation"
|
|
4383
|
-
},
|
|
4384
|
-
"style.opacity": {
|
|
4385
|
-
type: "number",
|
|
4386
|
-
min: 0,
|
|
4387
|
-
max: 1,
|
|
4388
|
-
step: 0.01,
|
|
4389
|
-
default: 1,
|
|
4390
|
-
description: "Opacity",
|
|
4391
|
-
hiddenFromList: false
|
|
4392
4509
|
}
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
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");
|
|
4418
4542
|
}
|
|
4419
|
-
}
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
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;
|
|
4424
4549
|
}
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
description: "Top left radius",
|
|
4442
|
-
hiddenFromList: false
|
|
4443
|
-
},
|
|
4444
|
-
"style.borderTopRightRadius": {
|
|
4445
|
-
type: "number",
|
|
4446
|
-
default: 0,
|
|
4447
|
-
min: 0,
|
|
4448
|
-
step: 1,
|
|
4449
|
-
description: "Top right radius",
|
|
4450
|
-
hiddenFromList: false
|
|
4451
|
-
},
|
|
4452
|
-
"style.borderBottomRightRadius": {
|
|
4453
|
-
type: "number",
|
|
4454
|
-
default: 0,
|
|
4455
|
-
min: 0,
|
|
4456
|
-
step: 1,
|
|
4457
|
-
description: "Bottom right radius",
|
|
4458
|
-
hiddenFromList: false
|
|
4459
|
-
},
|
|
4460
|
-
"style.borderBottomLeftRadius": {
|
|
4461
|
-
type: "number",
|
|
4462
|
-
default: 0,
|
|
4463
|
-
min: 0,
|
|
4464
|
-
step: 1,
|
|
4465
|
-
description: "Bottom left radius",
|
|
4466
|
-
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;
|
|
4467
4566
|
}
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
"style.backgroundColor": {
|
|
4471
|
-
type: "color",
|
|
4472
|
-
default: "transparent",
|
|
4473
|
-
description: "Color"
|
|
4567
|
+
static step1(n) {
|
|
4568
|
+
return n >= 1 ? 1 : 0;
|
|
4474
4569
|
}
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
color: {
|
|
4478
|
-
type: "color",
|
|
4479
|
-
default: undefined,
|
|
4480
|
-
description: "Current color"
|
|
4570
|
+
static linear(t) {
|
|
4571
|
+
return t;
|
|
4481
4572
|
}
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
stroke: {
|
|
4486
|
-
type: "color",
|
|
4487
|
-
default: "none",
|
|
4488
|
-
description: "Stroke"
|
|
4489
|
-
},
|
|
4490
|
-
strokeWidth: {
|
|
4491
|
-
type: "number",
|
|
4492
|
-
default: 1,
|
|
4493
|
-
description: "Stroke width",
|
|
4494
|
-
min: 0,
|
|
4495
|
-
step: 1,
|
|
4496
|
-
hiddenFromList: false
|
|
4573
|
+
static ease(t) {
|
|
4574
|
+
easeBezier ??= Easing2.bezier(0.42, 0, 1, 1);
|
|
4575
|
+
return easeBezier(t);
|
|
4497
4576
|
}
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
fill: {
|
|
4501
|
-
type: "color",
|
|
4502
|
-
default: undefined,
|
|
4503
|
-
description: "Fill"
|
|
4504
|
-
},
|
|
4505
|
-
...svgStrokeSchema
|
|
4506
|
-
};
|
|
4507
|
-
var premountSchema = {
|
|
4508
|
-
premountFor: {
|
|
4509
|
-
type: "number",
|
|
4510
|
-
default: undefined,
|
|
4511
|
-
description: "Premount For",
|
|
4512
|
-
min: 0,
|
|
4513
|
-
step: 1,
|
|
4514
|
-
hiddenFromList: false,
|
|
4515
|
-
keyframable: false
|
|
4516
|
-
},
|
|
4517
|
-
postmountFor: {
|
|
4518
|
-
type: "number",
|
|
4519
|
-
default: 0,
|
|
4520
|
-
min: 0,
|
|
4521
|
-
step: 1,
|
|
4522
|
-
hiddenFromList: true,
|
|
4523
|
-
keyframable: false
|
|
4577
|
+
static quad(t) {
|
|
4578
|
+
return t * t;
|
|
4524
4579
|
}
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
...premountSchema
|
|
4528
|
-
};
|
|
4529
|
-
var cropSchema = {
|
|
4530
|
-
cropLeft: {
|
|
4531
|
-
type: "number",
|
|
4532
|
-
default: 0,
|
|
4533
|
-
description: "Crop left",
|
|
4534
|
-
min: 0,
|
|
4535
|
-
max: 1,
|
|
4536
|
-
step: 0.01,
|
|
4537
|
-
hiddenFromList: false,
|
|
4538
|
-
keyframable: true
|
|
4539
|
-
},
|
|
4540
|
-
cropRight: {
|
|
4541
|
-
type: "number",
|
|
4542
|
-
default: 0,
|
|
4543
|
-
description: "Crop right",
|
|
4544
|
-
min: 0,
|
|
4545
|
-
max: 1,
|
|
4546
|
-
step: 0.01,
|
|
4547
|
-
hiddenFromList: false,
|
|
4548
|
-
keyframable: true
|
|
4549
|
-
},
|
|
4550
|
-
cropTop: {
|
|
4551
|
-
type: "number",
|
|
4552
|
-
default: 0,
|
|
4553
|
-
description: "Crop top",
|
|
4554
|
-
min: 0,
|
|
4555
|
-
max: 1,
|
|
4556
|
-
step: 0.01,
|
|
4557
|
-
hiddenFromList: false,
|
|
4558
|
-
keyframable: true
|
|
4559
|
-
},
|
|
4560
|
-
cropBottom: {
|
|
4561
|
-
type: "number",
|
|
4562
|
-
default: 0,
|
|
4563
|
-
description: "Crop bottom",
|
|
4564
|
-
min: 0,
|
|
4565
|
-
max: 1,
|
|
4566
|
-
step: 0.01,
|
|
4567
|
-
hiddenFromList: false,
|
|
4568
|
-
keyframable: true
|
|
4580
|
+
static cubic(t) {
|
|
4581
|
+
return t * t * t;
|
|
4569
4582
|
}
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
var sequenceStyleSchema = {
|
|
4573
|
-
...sequenceCropSchema,
|
|
4574
|
-
...transformSchema,
|
|
4575
|
-
...backgroundSchema,
|
|
4576
|
-
...borderSchema,
|
|
4577
|
-
...borderRadiusSchema
|
|
4578
|
-
};
|
|
4579
|
-
var hiddenField = {
|
|
4580
|
-
type: "boolean",
|
|
4581
|
-
default: false,
|
|
4582
|
-
description: "Hidden"
|
|
4583
|
-
};
|
|
4584
|
-
var showInTimelineField = {
|
|
4585
|
-
type: "hidden"
|
|
4586
|
-
};
|
|
4587
|
-
var sequenceNameField = {
|
|
4588
|
-
type: "hidden"
|
|
4589
|
-
};
|
|
4590
|
-
var durationInFramesField = {
|
|
4591
|
-
type: "number",
|
|
4592
|
-
default: undefined,
|
|
4593
|
-
min: 1,
|
|
4594
|
-
step: 1,
|
|
4595
|
-
hiddenFromList: true
|
|
4596
|
-
};
|
|
4597
|
-
var fromField = {
|
|
4598
|
-
type: "number",
|
|
4599
|
-
default: 0,
|
|
4600
|
-
step: 1,
|
|
4601
|
-
hiddenFromList: true
|
|
4602
|
-
};
|
|
4603
|
-
var trimBeforeField = {
|
|
4604
|
-
type: "number",
|
|
4605
|
-
default: 0,
|
|
4606
|
-
min: 0,
|
|
4607
|
-
step: 1,
|
|
4608
|
-
hiddenFromList: true
|
|
4609
|
-
};
|
|
4610
|
-
var sequenceTimingSchema = {
|
|
4611
|
-
from: {
|
|
4612
|
-
...fromField,
|
|
4613
|
-
description: "From",
|
|
4614
|
-
hiddenFromList: false,
|
|
4615
|
-
keyframable: false
|
|
4616
|
-
},
|
|
4617
|
-
durationInFrames: {
|
|
4618
|
-
...durationInFramesField,
|
|
4619
|
-
description: "Duration",
|
|
4620
|
-
hiddenFromList: false,
|
|
4621
|
-
keyframable: false
|
|
4622
|
-
},
|
|
4623
|
-
trimBefore: {
|
|
4624
|
-
...trimBeforeField,
|
|
4625
|
-
description: "Trim before",
|
|
4626
|
-
hiddenFromList: false,
|
|
4627
|
-
keyframable: false
|
|
4583
|
+
static poly(n) {
|
|
4584
|
+
return (t) => t ** n;
|
|
4628
4585
|
}
|
|
4629
|
-
|
|
4630
|
-
|
|
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
|
-
|
|
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;
|
|
4664
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;
|
|
4665
4653
|
}
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
durationInFrames: durationInFramesField,
|
|
4669
|
-
trimBefore: trimBeforeField,
|
|
4670
|
-
playbackRate: playbackRateField,
|
|
4671
|
-
freeze: freezeField,
|
|
4672
|
-
hidden: hiddenField,
|
|
4673
|
-
name: sequenceNameField,
|
|
4674
|
-
showInTimeline: showInTimelineField
|
|
4675
|
-
};
|
|
4676
|
-
var sequenceSchemaWithoutFrom = {
|
|
4677
|
-
...baseSchemaWithoutFrom,
|
|
4678
|
-
layout: sequenceSchema.layout
|
|
4679
|
-
};
|
|
4680
|
-
var sequenceSchemaDefaultLayoutNone = {
|
|
4681
|
-
...sequenceSchema,
|
|
4682
|
-
layout: {
|
|
4683
|
-
...sequenceSchema.layout,
|
|
4684
|
-
default: "none"
|
|
4654
|
+
static bezier(x1, y1, x2, y2) {
|
|
4655
|
+
return bezier(x1, y1, x2, y2);
|
|
4685
4656
|
}
|
|
4686
|
-
|
|
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
|
+
}
|
|
4687
4672
|
var NUMBER = "[-+]?\\\\d*\\\\.?\\\\d+";
|
|
4688
4673
|
var PERCENTAGE = NUMBER + "%";
|
|
4689
4674
|
function call(...args) {
|
|
@@ -5135,6 +5120,119 @@ function processColor(color) {
|
|
|
5135
5120
|
const normalizedColor = normalizeColor(color);
|
|
5136
5121
|
return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
|
|
5137
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
|
+
};
|
|
5138
5236
|
var proResProfileOptions = [
|
|
5139
5237
|
"4444-xq",
|
|
5140
5238
|
"4444",
|
|
@@ -5182,9 +5280,6 @@ var serializeScaleValue = ([x, y, z]) => {
|
|
|
5182
5280
|
}
|
|
5183
5281
|
return \`\${normalizedX} \${normalizedY} \${normalizedZ}\`;
|
|
5184
5282
|
};
|
|
5185
|
-
function truthy(value) {
|
|
5186
|
-
return Boolean(value);
|
|
5187
|
-
}
|
|
5188
5283
|
var validateSelectedFrames = ({
|
|
5189
5284
|
frames,
|
|
5190
5285
|
durationInFrames
|
|
@@ -5218,102 +5313,7 @@ var validateSelectedFrames = ({
|
|
|
5218
5313
|
}
|
|
5219
5314
|
return [...frames].sort((a, b) => a - b);
|
|
5220
5315
|
};
|
|
5221
|
-
var
|
|
5222
|
-
"h264",
|
|
5223
|
-
"h265",
|
|
5224
|
-
"vp8",
|
|
5225
|
-
"vp9",
|
|
5226
|
-
"av1",
|
|
5227
|
-
"mp3",
|
|
5228
|
-
"aac",
|
|
5229
|
-
"wav",
|
|
5230
|
-
"prores",
|
|
5231
|
-
"h264-mkv",
|
|
5232
|
-
"h264-ts",
|
|
5233
|
-
"gif"
|
|
5234
|
-
];
|
|
5235
|
-
function validateCodec(defaultCodec, location, name) {
|
|
5236
|
-
if (typeof defaultCodec === "undefined") {
|
|
5237
|
-
return;
|
|
5238
|
-
}
|
|
5239
|
-
if (typeof defaultCodec !== "string") {
|
|
5240
|
-
throw new TypeError(\`The "\${name}" prop \${location} must be a string, but you passed a value of type \${typeof defaultCodec}.\`);
|
|
5241
|
-
}
|
|
5242
|
-
if (!validCodecs.includes(defaultCodec)) {
|
|
5243
|
-
throw new Error(\`The "\${name}" prop \${location} must be one of \${validCodecs.join(", ")}, but you passed \${defaultCodec}.\`);
|
|
5244
|
-
}
|
|
5245
|
-
}
|
|
5246
|
-
var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
5247
|
-
if (!defaultProps) {
|
|
5248
|
-
return;
|
|
5249
|
-
}
|
|
5250
|
-
if (typeof defaultProps !== "object") {
|
|
5251
|
-
throw new Error(\`"\${name}" must be an object, but you passed a value of type \${typeof defaultProps}\`);
|
|
5252
|
-
}
|
|
5253
|
-
if (Array.isArray(defaultProps)) {
|
|
5254
|
-
throw new Error(\`"\${name}" must be an object, an array was passed \${compositionId ? \`for composition "\${compositionId}"\` : ""}\`);
|
|
5255
|
-
}
|
|
5256
|
-
};
|
|
5257
|
-
function validateDimension(amount, nameOfProp, location) {
|
|
5258
|
-
if (typeof amount !== "number") {
|
|
5259
|
-
throw new Error(\`The "\${nameOfProp}" prop \${location} must be a number, but you passed a value of type \${typeof amount}\`);
|
|
5260
|
-
}
|
|
5261
|
-
if (isNaN(amount)) {
|
|
5262
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must not be NaN, but is NaN.\`);
|
|
5263
|
-
}
|
|
5264
|
-
if (!Number.isFinite(amount)) {
|
|
5265
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be finite, but is \${amount}.\`);
|
|
5266
|
-
}
|
|
5267
|
-
if (amount % 1 !== 0) {
|
|
5268
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be an integer, but is \${amount}.\`);
|
|
5269
|
-
}
|
|
5270
|
-
if (amount <= 0) {
|
|
5271
|
-
throw new TypeError(\`The "\${nameOfProp}" prop \${location} must be positive, but got \${amount}.\`);
|
|
5272
|
-
}
|
|
5273
|
-
}
|
|
5274
|
-
function validateDurationInFrames(durationInFrames, options) {
|
|
5275
|
-
const { allowFloats, component } = options;
|
|
5276
|
-
if (typeof durationInFrames === "undefined") {
|
|
5277
|
-
throw new Error(\`The "durationInFrames" prop \${component} is missing.\`);
|
|
5278
|
-
}
|
|
5279
|
-
if (typeof durationInFrames !== "number") {
|
|
5280
|
-
throw new Error(\`The "durationInFrames" prop \${component} must be a number, but you passed a value of type \${typeof durationInFrames}\`);
|
|
5281
|
-
}
|
|
5282
|
-
if (durationInFrames <= 0) {
|
|
5283
|
-
throw new TypeError(\`The "durationInFrames" prop \${component} must be positive, but got \${durationInFrames}.\`);
|
|
5284
|
-
}
|
|
5285
|
-
if (!Number.isFinite(durationInFrames)) {
|
|
5286
|
-
throw new TypeError(\`The "durationInFrames" prop \${component} must be finite, but got \${durationInFrames}.\`);
|
|
5287
|
-
}
|
|
5288
|
-
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
5289
|
-
throw new TypeError(\`The "durationInFrames" prop \${component} must be an integer, but got \${durationInFrames}.\`);
|
|
5290
|
-
}
|
|
5291
|
-
}
|
|
5292
|
-
var getExpectedMediaFrameUncorrected = ({
|
|
5293
|
-
frame,
|
|
5294
|
-
playbackRate,
|
|
5295
|
-
startFrom
|
|
5296
|
-
}) => {
|
|
5297
|
-
return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
5298
|
-
};
|
|
5299
|
-
var getAbsoluteSrc = (relativeSrc) => {
|
|
5300
|
-
if (typeof window === "undefined") {
|
|
5301
|
-
return relativeSrc;
|
|
5302
|
-
}
|
|
5303
|
-
if (relativeSrc.startsWith("http://") || relativeSrc.startsWith("https://") || relativeSrc.startsWith("file://") || relativeSrc.startsWith("blob:") || relativeSrc.startsWith("data:")) {
|
|
5304
|
-
return relativeSrc;
|
|
5305
|
-
}
|
|
5306
|
-
return new URL(relativeSrc, document.baseURI).href;
|
|
5307
|
-
};
|
|
5308
|
-
var getOffthreadVideoSource = ({
|
|
5309
|
-
src,
|
|
5310
|
-
transparent,
|
|
5311
|
-
currentTime,
|
|
5312
|
-
toneMapped
|
|
5313
|
-
}) => {
|
|
5314
|
-
return \`http://localhost:\${window.remotion_proxyPort}/proxy?src=\${encodeURIComponent(getAbsoluteSrc(src))}&time=\${encodeURIComponent(Math.max(0, currentTime))}&transparent=\${String(transparent)}&toneMapped=\${String(toneMapped)}\`;
|
|
5315
|
-
};
|
|
5316
|
-
var NoReactInternals = {
|
|
5316
|
+
var NoReactInternals2 = {
|
|
5317
5317
|
validatePreferredEffectBackend,
|
|
5318
5318
|
DEFAULT_PREMOUNT_IN_SECONDS,
|
|
5319
5319
|
DEFAULT_STUDIO_PREMOUNT_IN_SECONDS,
|
|
@@ -5404,7 +5404,7 @@ var uploadToVercelBlob = async ({
|
|
|
5404
5404
|
return { url: blob.downloadUrl, size };
|
|
5405
5405
|
};
|
|
5406
5406
|
try {
|
|
5407
|
-
const serializedInputProps =
|
|
5407
|
+
const serializedInputProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
5408
5408
|
data: config.inputProps,
|
|
5409
5409
|
indent: undefined,
|
|
5410
5410
|
staticBase: null
|
|
@@ -5451,7 +5451,7 @@ try {
|
|
|
5451
5451
|
offthreadVideoCacheSizeInBytes: config.offthreadVideoCacheSizeInBytes,
|
|
5452
5452
|
offthreadVideoThreads: config.offthreadVideoThreads
|
|
5453
5453
|
});
|
|
5454
|
-
const serializedResolvedProps =
|
|
5454
|
+
const serializedResolvedProps = NoReactInternals2.serializeJSONWithSpecialTypes({
|
|
5455
5455
|
data: composition.props,
|
|
5456
5456
|
indent: undefined,
|
|
5457
5457
|
staticBase: null
|
|
@@ -5491,6 +5491,7 @@ try {
|
|
|
5491
5491
|
numberOfGifLoops: config.numberOfGifLoops,
|
|
5492
5492
|
x264Preset: config.x264Preset,
|
|
5493
5493
|
gopSize: config.gopSize,
|
|
5494
|
+
proResBitsPerMacroblock: config.proResBitsPerMacroblock,
|
|
5494
5495
|
colorSpace: config.colorSpace,
|
|
5495
5496
|
jpegQuality: config.jpegQuality,
|
|
5496
5497
|
audioCodec: config.audioCodec,
|
|
@@ -5985,6 +5986,7 @@ var internalRenderMediaOnVercel = async (options) => {
|
|
|
5985
5986
|
numberOfGifLoops,
|
|
5986
5987
|
x264Preset,
|
|
5987
5988
|
gopSize,
|
|
5989
|
+
proResBitsPerMacroblock,
|
|
5988
5990
|
colorSpace = "default",
|
|
5989
5991
|
jpegQuality = 80,
|
|
5990
5992
|
audioCodec,
|
|
@@ -6037,6 +6039,7 @@ var internalRenderMediaOnVercel = async (options) => {
|
|
|
6037
6039
|
numberOfGifLoops: numberOfGifLoops ?? null,
|
|
6038
6040
|
x264Preset: x264Preset ?? null,
|
|
6039
6041
|
gopSize: gopSize ?? null,
|
|
6042
|
+
proResBitsPerMacroblock: proResBitsPerMacroblock ?? null,
|
|
6040
6043
|
colorSpace,
|
|
6041
6044
|
jpegQuality,
|
|
6042
6045
|
audioCodec: audioCodec ?? null,
|