@remotion/rive 4.0.534 → 4.0.536
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/RemotionRiveCanvas.d.ts +2 -1
- package/dist/cjs/RemotionRiveCanvas.js +49 -56
- package/dist/esm/index.mjs +50 -18
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Artboard, CanvasRenderer, File, FileAsset, LinearAnimationInstance, RiveCanvas } from '@rive-app/canvas-advanced';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { EffectsProp, InteractiveBaseProps, InteractivePremountProps, InteractiveCropProps, InteractivitySchema } from 'remotion';
|
|
3
|
+
import type { EffectsProp, EffectsOutputSize, InteractiveBaseProps, InteractivePremountProps, InteractiveCropProps, InteractivitySchema } from 'remotion';
|
|
4
4
|
import type { RemotionRiveCanvasAlignment, RemotionRiveCanvasFit } from './map-enums.js';
|
|
5
5
|
type assetLoadCallback = (asset: FileAsset, bytes: Uint8Array) => boolean;
|
|
6
6
|
type onLoadCallback = (file: File) => void;
|
|
@@ -16,6 +16,7 @@ type RemotionRiveCanvasOwnProps = {
|
|
|
16
16
|
readonly className?: string;
|
|
17
17
|
readonly style?: React.CSSProperties;
|
|
18
18
|
readonly effects?: EffectsProp;
|
|
19
|
+
readonly effectsOutputSize?: EffectsOutputSize;
|
|
19
20
|
};
|
|
20
21
|
export type RemotionRiveCanvasProps = RemotionRiveCanvasOwnProps & InteractiveBaseProps & InteractivePremountProps & InteractiveCropProps;
|
|
21
22
|
export type RiveCanvasRef = {
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -39,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
6
|
exports.RemotionRiveCanvas = exports.riveCanvasSchema = void 0;
|
|
40
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
8
|
const canvas_advanced_1 = __importDefault(require("@rive-app/canvas-advanced"));
|
|
42
|
-
const react_1 =
|
|
9
|
+
const react_1 = require("react");
|
|
43
10
|
const remotion_1 = require("remotion");
|
|
44
11
|
const map_enums_js_1 = require("./map-enums.js");
|
|
45
12
|
const { runEffectChain, useEffectChainState, useMemoizedEffectDefinitions, useMemoizedEffects, } = remotion_1.Internals;
|
|
@@ -84,14 +51,14 @@ exports.riveCanvasSchema = {
|
|
|
84
51
|
...remotion_1.Interactive.borderRadiusSchema,
|
|
85
52
|
...remotion_1.Interactive.cropSchema,
|
|
86
53
|
};
|
|
87
|
-
const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artboard: artboardName, animation: animationIndex, onLoad = null, assetLoader, enableRiveAssetCdn, className, style, effects, controls, canvasRef, }, ref) => {
|
|
88
|
-
var _a, _b;
|
|
54
|
+
const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artboard: artboardName, animation: animationIndex, onLoad = null, assetLoader, enableRiveAssetCdn, className, style, effects, effectsOutputSize, controls, canvasRef, }, ref) => {
|
|
55
|
+
var _a, _b, _c;
|
|
89
56
|
const { width, fps, height } = (0, remotion_1.useVideoConfig)();
|
|
90
57
|
const frame = (0, remotion_1.useCurrentFrame)();
|
|
91
|
-
const [
|
|
58
|
+
const [loadedRuntime, setLoadedRuntime] = (0, react_1.useState)(null);
|
|
59
|
+
const riveCanvasInstance = (_a = loadedRuntime === null || loadedRuntime === void 0 ? void 0 : loadedRuntime.instance) !== null && _a !== void 0 ? _a : null;
|
|
92
60
|
const [err, setError] = (0, react_1.useState)(null);
|
|
93
61
|
const { delayRender, continueRender } = (0, remotion_1.useDelayRender)();
|
|
94
|
-
const [handle] = (0, react_1.useState)(() => delayRender());
|
|
95
62
|
const lastFrame = (0, react_1.useRef)(0);
|
|
96
63
|
// Rive draws to this offscreen-style canvas; the effect chain then
|
|
97
64
|
// composites from here onto the visible output canvas.
|
|
@@ -101,11 +68,11 @@ const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artb
|
|
|
101
68
|
}
|
|
102
69
|
return document.createElement('canvas');
|
|
103
70
|
}, []);
|
|
104
|
-
const chainState = useEffectChainState();
|
|
71
|
+
const chainState = useEffectChainState(effectsOutputSize);
|
|
105
72
|
const memoizedEffects = useMemoizedEffects({
|
|
106
73
|
effects,
|
|
107
|
-
overrideId: (
|
|
108
|
-
videoConfigValues: (
|
|
74
|
+
overrideId: (_b = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _b !== void 0 ? _b : null,
|
|
75
|
+
videoConfigValues: (_c = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues) !== null && _c !== void 0 ? _c : null,
|
|
109
76
|
});
|
|
110
77
|
if (err) {
|
|
111
78
|
throw err;
|
|
@@ -130,35 +97,51 @@ const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artb
|
|
|
130
97
|
},
|
|
131
98
|
};
|
|
132
99
|
}, [rive, riveCanvasInstance]);
|
|
133
|
-
(0, react_1.
|
|
100
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
101
|
+
const handle = delayRender('Loading Rive runtime');
|
|
102
|
+
let cancelled = false;
|
|
134
103
|
(0, canvas_advanced_1.default)({
|
|
135
104
|
locateFile: () => 'https://unpkg.com/@rive-app/canvas-advanced@2.31.5/rive.wasm',
|
|
136
105
|
})
|
|
137
106
|
.then((riveInstance) => {
|
|
138
|
-
|
|
139
|
-
|
|
107
|
+
if (!cancelled) {
|
|
108
|
+
setLoadedRuntime({ instance: riveInstance, handle });
|
|
109
|
+
}
|
|
140
110
|
})
|
|
141
111
|
.catch((newErr) => {
|
|
142
|
-
|
|
112
|
+
if (!cancelled) {
|
|
113
|
+
setError(newErr);
|
|
114
|
+
}
|
|
143
115
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
116
|
+
return () => {
|
|
117
|
+
cancelled = true;
|
|
118
|
+
continueRender(handle);
|
|
119
|
+
};
|
|
120
|
+
}, [delayRender, continueRender]);
|
|
121
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
122
|
+
if (!riveCanvasInstance || !sourceCanvas || !loadedRuntime) {
|
|
147
123
|
return;
|
|
148
124
|
}
|
|
125
|
+
const handle = delayRender(`Loading <RemotionRiveCanvas src="${src}"/>`);
|
|
126
|
+
continueRender(loadedRuntime.handle);
|
|
127
|
+
let cancelled = false;
|
|
128
|
+
const controller = new AbortController();
|
|
149
129
|
sourceCanvas.width = width;
|
|
150
130
|
sourceCanvas.height = height;
|
|
151
131
|
const renderer = riveCanvasInstance.makeRenderer(sourceCanvas);
|
|
152
|
-
fetch(new Request(src))
|
|
132
|
+
fetch(new Request(src), { signal: controller.signal })
|
|
153
133
|
.then((f) => f.arrayBuffer())
|
|
154
134
|
.then((b) => {
|
|
155
|
-
riveCanvasInstance
|
|
135
|
+
return riveCanvasInstance
|
|
156
136
|
.load(new Uint8Array(b), assetLoader
|
|
157
137
|
? new riveCanvasInstance.CustomFileAssetLoader({
|
|
158
138
|
loadContents: assetLoader,
|
|
159
139
|
})
|
|
160
140
|
: undefined, enableRiveAssetCdn)
|
|
161
141
|
.then((file) => {
|
|
142
|
+
if (cancelled) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
162
145
|
const artboard = typeof artboardName === 'string'
|
|
163
146
|
? file.artboardByName(artboardName)
|
|
164
147
|
: typeof artboardName === 'number'
|
|
@@ -174,12 +157,20 @@ const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artb
|
|
|
174
157
|
artboard,
|
|
175
158
|
renderer,
|
|
176
159
|
file,
|
|
160
|
+
handle,
|
|
177
161
|
});
|
|
178
162
|
});
|
|
179
163
|
})
|
|
180
164
|
.catch((newErr) => {
|
|
181
|
-
|
|
165
|
+
if (!cancelled) {
|
|
166
|
+
setError(newErr);
|
|
167
|
+
}
|
|
182
168
|
});
|
|
169
|
+
return () => {
|
|
170
|
+
cancelled = true;
|
|
171
|
+
controller.abort();
|
|
172
|
+
continueRender(handle);
|
|
173
|
+
};
|
|
183
174
|
}, [
|
|
184
175
|
animationIndex,
|
|
185
176
|
artboardName,
|
|
@@ -191,13 +182,16 @@ const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artb
|
|
|
191
182
|
sourceCanvas,
|
|
192
183
|
width,
|
|
193
184
|
height,
|
|
185
|
+
loadedRuntime,
|
|
186
|
+
delayRender,
|
|
187
|
+
continueRender,
|
|
194
188
|
]);
|
|
195
189
|
(0, react_1.useEffect)(() => {
|
|
196
190
|
if (onLoad && rive) {
|
|
197
191
|
onLoad(rive.file);
|
|
198
192
|
}
|
|
199
193
|
}, [onLoad, rive]);
|
|
200
|
-
react_1.
|
|
194
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
201
195
|
if (!riveCanvasInstance || !rive) {
|
|
202
196
|
return;
|
|
203
197
|
}
|
|
@@ -245,6 +239,7 @@ const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artb
|
|
|
245
239
|
return;
|
|
246
240
|
}
|
|
247
241
|
const effectChainHandle = delayRender(`Rendering frame at ${frame} of <RemotionRiveCanvas src="${src}"/>`);
|
|
242
|
+
continueRender(rive.handle);
|
|
248
243
|
let cancelled = false;
|
|
249
244
|
runEffectChain({
|
|
250
245
|
state,
|
|
@@ -291,7 +286,7 @@ const RemotionRiveCanvasContentForwardRefFunction = ({ src, fit, alignment, artb
|
|
|
291
286
|
return (jsx_runtime_1.jsx("canvas", { ref: canvasRef, width: width, height: height, className: className, style: canvasStyle }));
|
|
292
287
|
};
|
|
293
288
|
const RemotionRiveCanvasContent = (0, react_1.forwardRef)(RemotionRiveCanvasContentForwardRefFunction);
|
|
294
|
-
const RemotionRiveCanvasInnerForwardRefFunction = ({ src, fit = 'contain', alignment = 'center', artboard, animation, onLoad = null, assetLoader, enableRiveAssetCdn = true, className, style, effects = [], controls, durationInFrames, name, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, showInTimeline, hidden, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
|
|
289
|
+
const RemotionRiveCanvasInnerForwardRefFunction = ({ src, fit = 'contain', alignment = 'center', artboard, animation, onLoad = null, assetLoader, enableRiveAssetCdn = true, className, style, effects = [], effectsOutputSize, controls, durationInFrames, name, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, showInTimeline, hidden, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
|
|
295
290
|
props;
|
|
296
291
|
const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
|
|
297
292
|
const canvasRef = (0, react_1.useRef)(null);
|
|
@@ -317,9 +312,7 @@ const RemotionRiveCanvasInnerForwardRefFunction = ({ src, fit = 'contain', align
|
|
|
317
312
|
style: premountingStyle,
|
|
318
313
|
componentName: '<RemotionRiveCanvas />',
|
|
319
314
|
});
|
|
320
|
-
return (jsx_runtime_1.jsx(remotion_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, name: name !== null && name !== void 0 ? name : '<RemotionRiveCanvas>', _remotionInternalDocumentationLink:
|
|
321
|
-
? 'https://www.remotion.dev/docs/rive/remotionrivecanvas'
|
|
322
|
-
: undefined, durationInFrames: durationInFrames, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...props, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(RemotionRiveCanvasContent, { ref: ref, src: src, fit: fit, alignment: alignment, artboard: artboard, animation: animation, onLoad: onLoad, assetLoader: assetLoader, enableRiveAssetCdn: enableRiveAssetCdn, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, controls: controls, canvasRef: canvasRef }) }) }));
|
|
315
|
+
return (jsx_runtime_1.jsx(remotion_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, children: jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, name: name !== null && name !== void 0 ? name : '<RemotionRiveCanvas>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/rive/remotionrivecanvas", durationInFrames: durationInFrames, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, ...props, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(RemotionRiveCanvasContent, { ref: ref, src: src, fit: fit, alignment: alignment, artboard: artboard, animation: animation, onLoad: onLoad, assetLoader: assetLoader, enableRiveAssetCdn: enableRiveAssetCdn, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, controls: controls, canvasRef: canvasRef }) }) }));
|
|
323
316
|
};
|
|
324
317
|
const RemotionRiveCanvasInner = (0, react_1.forwardRef)(RemotionRiveCanvasInnerForwardRefFunction);
|
|
325
318
|
exports.RemotionRiveCanvas = remotion_1.Interactive.withSchema({
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/RemotionRiveCanvas.tsx
|
|
2
2
|
import riveCanvas from "@rive-app/canvas-advanced";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
4
|
forwardRef,
|
|
5
5
|
useEffect,
|
|
6
6
|
useImperativeHandle,
|
|
7
|
+
useLayoutEffect,
|
|
7
8
|
useMemo,
|
|
8
9
|
useRef,
|
|
9
10
|
useState
|
|
@@ -135,15 +136,16 @@ var RemotionRiveCanvasContentForwardRefFunction = ({
|
|
|
135
136
|
className,
|
|
136
137
|
style,
|
|
137
138
|
effects,
|
|
139
|
+
effectsOutputSize,
|
|
138
140
|
controls,
|
|
139
141
|
canvasRef
|
|
140
142
|
}, ref) => {
|
|
141
143
|
const { width, fps, height } = useVideoConfig();
|
|
142
144
|
const frame = useCurrentFrame();
|
|
143
|
-
const [
|
|
145
|
+
const [loadedRuntime, setLoadedRuntime] = useState(null);
|
|
146
|
+
const riveCanvasInstance = loadedRuntime?.instance ?? null;
|
|
144
147
|
const [err, setError] = useState(null);
|
|
145
148
|
const { delayRender, continueRender } = useDelayRender();
|
|
146
|
-
const [handle] = useState(() => delayRender());
|
|
147
149
|
const lastFrame = useRef(0);
|
|
148
150
|
const sourceCanvas = useMemo(() => {
|
|
149
151
|
if (typeof document === "undefined") {
|
|
@@ -151,7 +153,7 @@ var RemotionRiveCanvasContentForwardRefFunction = ({
|
|
|
151
153
|
}
|
|
152
154
|
return document.createElement("canvas");
|
|
153
155
|
}, []);
|
|
154
|
-
const chainState = useEffectChainState();
|
|
156
|
+
const chainState = useEffectChainState(effectsOutputSize);
|
|
155
157
|
const memoizedEffects = useMemoizedEffects({
|
|
156
158
|
effects,
|
|
157
159
|
overrideId: controls?.overrideId ?? null,
|
|
@@ -177,39 +179,63 @@ var RemotionRiveCanvasContentForwardRefFunction = ({
|
|
|
177
179
|
}
|
|
178
180
|
};
|
|
179
181
|
}, [rive, riveCanvasInstance]);
|
|
180
|
-
|
|
182
|
+
useLayoutEffect(() => {
|
|
183
|
+
const handle = delayRender("Loading Rive runtime");
|
|
184
|
+
let cancelled = false;
|
|
181
185
|
riveCanvas({
|
|
182
186
|
locateFile: () => "https://unpkg.com/@rive-app/canvas-advanced@2.31.5/rive.wasm"
|
|
183
187
|
}).then((riveInstance) => {
|
|
184
|
-
|
|
185
|
-
|
|
188
|
+
if (!cancelled) {
|
|
189
|
+
setLoadedRuntime({ instance: riveInstance, handle });
|
|
190
|
+
}
|
|
186
191
|
}).catch((newErr) => {
|
|
187
|
-
|
|
192
|
+
if (!cancelled) {
|
|
193
|
+
setError(newErr);
|
|
194
|
+
}
|
|
188
195
|
});
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
196
|
+
return () => {
|
|
197
|
+
cancelled = true;
|
|
198
|
+
continueRender(handle);
|
|
199
|
+
};
|
|
200
|
+
}, [delayRender, continueRender]);
|
|
201
|
+
useLayoutEffect(() => {
|
|
202
|
+
if (!riveCanvasInstance || !sourceCanvas || !loadedRuntime) {
|
|
192
203
|
return;
|
|
193
204
|
}
|
|
205
|
+
const handle = delayRender(`Loading <RemotionRiveCanvas src="${src}"/>`);
|
|
206
|
+
continueRender(loadedRuntime.handle);
|
|
207
|
+
let cancelled = false;
|
|
208
|
+
const controller = new AbortController;
|
|
194
209
|
sourceCanvas.width = width;
|
|
195
210
|
sourceCanvas.height = height;
|
|
196
211
|
const renderer = riveCanvasInstance.makeRenderer(sourceCanvas);
|
|
197
|
-
fetch(new Request(src)).then((f) => f.arrayBuffer()).then((b) => {
|
|
198
|
-
riveCanvasInstance.load(new Uint8Array(b), assetLoader ? new riveCanvasInstance.CustomFileAssetLoader({
|
|
212
|
+
fetch(new Request(src), { signal: controller.signal }).then((f) => f.arrayBuffer()).then((b) => {
|
|
213
|
+
return riveCanvasInstance.load(new Uint8Array(b), assetLoader ? new riveCanvasInstance.CustomFileAssetLoader({
|
|
199
214
|
loadContents: assetLoader
|
|
200
215
|
}) : undefined, enableRiveAssetCdn).then((file) => {
|
|
216
|
+
if (cancelled) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
201
219
|
const artboard = typeof artboardName === "string" ? file.artboardByName(artboardName) : typeof artboardName === "number" ? file.artboardByIndex(artboardName) : file.defaultArtboard();
|
|
202
220
|
const animation = new riveCanvasInstance.LinearAnimationInstance(typeof animationIndex === "number" ? artboard.animationByIndex(animationIndex) : typeof animationIndex === "string" ? artboard.animationByName(animationIndex) : artboard.animationByIndex(0), artboard);
|
|
203
221
|
setRive({
|
|
204
222
|
animation,
|
|
205
223
|
artboard,
|
|
206
224
|
renderer,
|
|
207
|
-
file
|
|
225
|
+
file,
|
|
226
|
+
handle
|
|
208
227
|
});
|
|
209
228
|
});
|
|
210
229
|
}).catch((newErr) => {
|
|
211
|
-
|
|
230
|
+
if (!cancelled) {
|
|
231
|
+
setError(newErr);
|
|
232
|
+
}
|
|
212
233
|
});
|
|
234
|
+
return () => {
|
|
235
|
+
cancelled = true;
|
|
236
|
+
controller.abort();
|
|
237
|
+
continueRender(handle);
|
|
238
|
+
};
|
|
213
239
|
}, [
|
|
214
240
|
animationIndex,
|
|
215
241
|
artboardName,
|
|
@@ -220,14 +246,17 @@ var RemotionRiveCanvasContentForwardRefFunction = ({
|
|
|
220
246
|
enableRiveAssetCdn,
|
|
221
247
|
sourceCanvas,
|
|
222
248
|
width,
|
|
223
|
-
height
|
|
249
|
+
height,
|
|
250
|
+
loadedRuntime,
|
|
251
|
+
delayRender,
|
|
252
|
+
continueRender
|
|
224
253
|
]);
|
|
225
254
|
useEffect(() => {
|
|
226
255
|
if (onLoad && rive) {
|
|
227
256
|
onLoad(rive.file);
|
|
228
257
|
}
|
|
229
258
|
}, [onLoad, rive]);
|
|
230
|
-
|
|
259
|
+
useLayoutEffect(() => {
|
|
231
260
|
if (!riveCanvasInstance || !rive) {
|
|
232
261
|
return;
|
|
233
262
|
}
|
|
@@ -266,6 +295,7 @@ var RemotionRiveCanvasContentForwardRefFunction = ({
|
|
|
266
295
|
return;
|
|
267
296
|
}
|
|
268
297
|
const effectChainHandle = delayRender(`Rendering frame at ${frame} of <RemotionRiveCanvas src="${src}"/>`);
|
|
298
|
+
continueRender(rive.handle);
|
|
269
299
|
let cancelled = false;
|
|
270
300
|
runEffectChain({
|
|
271
301
|
state,
|
|
@@ -328,6 +358,7 @@ var RemotionRiveCanvasInnerForwardRefFunction = ({
|
|
|
328
358
|
className,
|
|
329
359
|
style,
|
|
330
360
|
effects = [],
|
|
361
|
+
effectsOutputSize,
|
|
331
362
|
controls,
|
|
332
363
|
durationInFrames,
|
|
333
364
|
name,
|
|
@@ -393,7 +424,7 @@ var RemotionRiveCanvasInnerForwardRefFunction = ({
|
|
|
393
424
|
hidden,
|
|
394
425
|
showInTimeline,
|
|
395
426
|
name: name ?? "<RemotionRiveCanvas>",
|
|
396
|
-
_remotionInternalDocumentationLink:
|
|
427
|
+
_remotionInternalDocumentationLink: "https://www.remotion.dev/docs/rive/remotionrivecanvas",
|
|
397
428
|
durationInFrames,
|
|
398
429
|
controls,
|
|
399
430
|
_remotionInternalEffects: memoizedEffectDefinitions,
|
|
@@ -415,6 +446,7 @@ var RemotionRiveCanvasInnerForwardRefFunction = ({
|
|
|
415
446
|
className,
|
|
416
447
|
style: croppedStyle ?? undefined,
|
|
417
448
|
effects,
|
|
449
|
+
effectsOutputSize: effectsOutputSize ?? null,
|
|
418
450
|
controls,
|
|
419
451
|
canvasRef
|
|
420
452
|
})
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/rive"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/rive",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.536",
|
|
7
7
|
"description": "Embed Rive animations in a Remotion video",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "See LICENSE.md",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@rive-app/canvas-advanced": "2.31.5",
|
|
26
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.536"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=18.2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"react": "19.2.3",
|
|
34
34
|
"react-dom": "19.2.3",
|
|
35
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
35
|
+
"@remotion/eslint-config-internal": "4.0.536",
|
|
36
36
|
"eslint": "9.19.0",
|
|
37
37
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
38
38
|
},
|