@remotion/motion-blur 4.0.544 → 4.0.546
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/CameraMotionBlur.js +13 -8
- package/dist/cjs/HtmlInCanvasMotionBlur.d.ts +3 -2
- package/dist/cjs/HtmlInCanvasMotionBlur.js +85 -36
- package/dist/cjs/Trail.js +6 -2
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/motion-blur-compositor.d.ts +15 -0
- package/dist/cjs/motion-blur-compositor.js +353 -0
- package/dist/cjs/motion-blur-context.d.ts +9 -0
- package/dist/cjs/motion-blur-context.js +60 -0
- package/dist/esm/index.mjs +546 -60
- package/package.json +5 -4
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CameraMotionBlur = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const motion_blur_context_1 = require("./motion-blur-context");
|
|
6
7
|
/**
|
|
7
8
|
* If the current frame is 0, then it is rendered with low opacity,
|
|
8
9
|
* and the trailing elements have frame numbers -1, -2, -3, -4, etc.
|
|
@@ -25,6 +26,7 @@ const getNumberOfSamples = ({ shutterFraction, samples, currentFrame, }) => {
|
|
|
25
26
|
*/
|
|
26
27
|
const CameraMotionBlur = ({ children, shutterAngle = 180, samples = 10, }) => {
|
|
27
28
|
const currentFrame = (0, remotion_1.useCurrentFrame)();
|
|
29
|
+
const registry = (0, motion_blur_context_1.useMotionBlurRegistry)('CameraMotionBlur');
|
|
28
30
|
if (typeof samples !== 'number' ||
|
|
29
31
|
Number.isNaN(samples) ||
|
|
30
32
|
!Number.isFinite(samples)) {
|
|
@@ -50,13 +52,16 @@ const CameraMotionBlur = ({ children, shutterAngle = 180, samples = 10, }) => {
|
|
|
50
52
|
samples,
|
|
51
53
|
shutterFraction,
|
|
52
54
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
if (registry === null)
|
|
56
|
+
return null;
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)(remotion_1.AbsoluteFill, { style: { isolation: 'isolate' }, children: [(0, jsx_runtime_1.jsx)(remotion_1.AbsoluteFill, { style: { opacity: actualSamples > 1 ? 0 : 1 }, children: (0, jsx_runtime_1.jsx)(motion_blur_context_1.MotionBlurSampleProvider, { sampleIndex: 0, registry: registry, children: children }) }), new Array(actualSamples > 1 ? actualSamples : 0)
|
|
58
|
+
.fill(true)
|
|
59
|
+
.map((_, i) => {
|
|
60
|
+
const sampleFrameOffset = shutterFraction * ((i + 1) / actualSamples);
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.AbsoluteFill, { style: {
|
|
62
|
+
mixBlendMode: 'plus-lighter',
|
|
63
|
+
filter: `opacity(${1 / actualSamples})`,
|
|
64
|
+
}, children: (0, jsx_runtime_1.jsx)(remotion_1.Freeze, { frame: currentFrame - sampleFrameOffset + 1, children: (0, jsx_runtime_1.jsx)(motion_blur_context_1.MotionBlurSampleProvider, { sampleIndex: i + 1, registry: registry, children: children }) }) }, `frame-${i.toString()}`));
|
|
65
|
+
})] }));
|
|
61
66
|
};
|
|
62
67
|
exports.CameraMotionBlur = CameraMotionBlur;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type InteractiveBaseProps, type InteractivePremountProps } from 'remotion';
|
|
3
|
-
export type HtmlInCanvasMotionBlurProps = InteractiveBaseProps & InteractivePremountProps & {
|
|
2
|
+
import { type InteractiveBaseProps, type InteractivePremountProps, type InteractiveTransformProps } from 'remotion';
|
|
3
|
+
export type HtmlInCanvasMotionBlurProps = InteractiveBaseProps & InteractivePremountProps & InteractiveTransformProps & {
|
|
4
4
|
readonly children: React.ReactNode;
|
|
5
5
|
readonly width: number;
|
|
6
6
|
readonly height: number;
|
|
7
7
|
readonly shutterAngle?: number;
|
|
8
8
|
readonly samples?: number;
|
|
9
9
|
readonly disabled?: boolean;
|
|
10
|
+
readonly disabledInPreview?: boolean;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Experimental motion blur that averages separately captured HTML-in-canvas
|
|
@@ -4,8 +4,11 @@ exports.HtmlInCanvasMotionBlur = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const motion_blur_compositor_1 = require("./motion-blur-compositor");
|
|
8
|
+
const motion_blur_context_1 = require("./motion-blur-context");
|
|
7
9
|
const htmlInCanvasMotionBlurSchema = {
|
|
8
10
|
...remotion_1.Interactive.baseSchema,
|
|
11
|
+
...remotion_1.Interactive.transformSchema,
|
|
9
12
|
shutterAngle: {
|
|
10
13
|
type: 'number',
|
|
11
14
|
min: 0,
|
|
@@ -31,11 +34,19 @@ const htmlInCanvasMotionBlurSchema = {
|
|
|
31
34
|
default: false,
|
|
32
35
|
description: 'Disabled',
|
|
33
36
|
},
|
|
37
|
+
disabledInPreview: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
default: false,
|
|
40
|
+
description: 'Disabled in preview',
|
|
41
|
+
keyframable: false,
|
|
42
|
+
},
|
|
34
43
|
};
|
|
35
|
-
const MotionBlurSample = ({ children, width, height, index, count, shutterInFrames, firstFrame, lastFrame, }) => {
|
|
44
|
+
const MotionBlurSample = ({ children, width, height, index, count, shutterInFrames, firstFrame, lastFrame, registry, }) => {
|
|
36
45
|
const frame = (0, remotion_1.useCurrentFrame)();
|
|
37
|
-
const
|
|
38
|
-
const
|
|
46
|
+
const isRepresentativeSample = index === 0;
|
|
47
|
+
const sampleFrame = isRepresentativeSample
|
|
48
|
+
? frame
|
|
49
|
+
: Math.max(firstFrame, Math.min(lastFrame, frame + ((index - 0.5) / count - 0.5) * shutterInFrames));
|
|
39
50
|
return ((0, jsx_runtime_1.jsx)("div", { "aria-hidden": !isRepresentativeSample, ...(index === 0 ? {} : { drawable: '' }), style: {
|
|
40
51
|
position: 'absolute',
|
|
41
52
|
inset: 0,
|
|
@@ -48,12 +59,16 @@ const MotionBlurSample = ({ children, width, height, index, count, shutterInFram
|
|
|
48
59
|
// Test: https://github.com/remotion-dev/remotion/blob/5d2ff05db91c1e5a02fc3d01f359638e98807882/packages/it-tests/src/ssr/render-frames.test.ts#L77
|
|
49
60
|
visibility: 'visible',
|
|
50
61
|
pointerEvents: isRepresentativeSample ? 'auto' : 'none',
|
|
51
|
-
}, children: (0, jsx_runtime_1.jsx)(remotion_1.
|
|
62
|
+
}, children: (0, jsx_runtime_1.jsx)(remotion_1.Freeze, { frame: sampleFrame, active: !isRepresentativeSample, children: (0, jsx_runtime_1.jsx)(motion_blur_context_1.MotionBlurSampleProvider, { sampleIndex: index, registry: registry, children: children }) }) }));
|
|
52
63
|
};
|
|
53
|
-
const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 180, samples = 8, disabled = false, from, durationInFrames, trimBefore, playbackRate, loop, freeze, hidden, name, premountFor, postmountFor, showInTimeline, styleWhilePremounted, styleWhilePostmounted, controls, }) => {
|
|
64
|
+
const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 180, samples = 8, disabled = false, disabledInPreview = false, from, durationInFrames, trimBefore, playbackRate, loop, freeze, hidden, name, premountFor, postmountFor, showInTimeline, style, styleWhilePremounted, styleWhilePostmounted, controls, }) => {
|
|
54
65
|
const { durationInFrames: compositionDurationInFrames } = (0, remotion_1.useVideoConfig)();
|
|
66
|
+
const { isRendering } = (0, remotion_1.useRemotionEnvironment)();
|
|
55
67
|
const videoEnabled = remotion_1.Internals.useVideoEnabled();
|
|
56
|
-
const
|
|
68
|
+
const preferredBackend = (0, react_1.useContext)(remotion_1.Internals.PreferredEffectBackendContext);
|
|
69
|
+
const registry = (0, motion_blur_context_1.useMotionBlurRegistry)('HtmlInCanvasMotionBlur');
|
|
70
|
+
const gpuDeviceRef = (0, react_1.useRef)(null);
|
|
71
|
+
const compositorRef = (0, react_1.useRef)(null);
|
|
57
72
|
if (!Number.isInteger(samples) || samples < 1 || samples > 64) {
|
|
58
73
|
throw new TypeError(`"samples" must be an integer between 1 and 64, but got ${String(samples)}`);
|
|
59
74
|
}
|
|
@@ -65,7 +80,13 @@ const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 1
|
|
|
65
80
|
}
|
|
66
81
|
// Keep the first sample mounted when blur is disabled so the canvas stays visible.
|
|
67
82
|
// Audio-only frames mount the children once so their audio is captured once.
|
|
68
|
-
const actualSamples = disabled ||
|
|
83
|
+
const actualSamples = disabled ||
|
|
84
|
+
(disabledInPreview && !isRendering) ||
|
|
85
|
+
shutterAngle === 0 ||
|
|
86
|
+
!videoEnabled
|
|
87
|
+
? 1
|
|
88
|
+
: samples;
|
|
89
|
+
const renderedSampleCount = actualSamples === 1 ? 1 : actualSamples + 1;
|
|
69
90
|
const shutterInFrames = (shutterAngle / 360) * (playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1);
|
|
70
91
|
const firstFrame = trimBefore !== null && trimBefore !== void 0 ? trimBefore : 0;
|
|
71
92
|
const visibleDuration = Math.max(0, Math.min(remotion_1.Internals.resolveSequenceDuration({
|
|
@@ -74,7 +95,17 @@ const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 1
|
|
|
74
95
|
loop,
|
|
75
96
|
}), compositionDurationInFrames - (from !== null && from !== void 0 ? from : 0)));
|
|
76
97
|
const lastFrame = firstFrame + Math.max(0, visibleDuration - 1) * (playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1);
|
|
98
|
+
const onInit = (0, react_1.useCallback)(async () => {
|
|
99
|
+
gpuDeviceRef.current = await (0, motion_blur_compositor_1.getMotionBlurGpuDevice)();
|
|
100
|
+
return () => {
|
|
101
|
+
var _a;
|
|
102
|
+
gpuDeviceRef.current = null;
|
|
103
|
+
(_a = compositorRef.current) === null || _a === void 0 ? void 0 : _a.compositor.dispose();
|
|
104
|
+
compositorRef.current = null;
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
77
107
|
const onPaint = (0, react_1.useCallback)(({ canvas, element, elementImage }) => {
|
|
108
|
+
var _a, _b, _c;
|
|
78
109
|
const context = canvas.getContext('2d');
|
|
79
110
|
if (!context) {
|
|
80
111
|
throw new Error('Failed to acquire 2D context for motion blur');
|
|
@@ -84,53 +115,71 @@ const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 1
|
|
|
84
115
|
throw new Error('Failed to find the HTML-in-canvas layout canvas');
|
|
85
116
|
}
|
|
86
117
|
const captureElements = Array.from(layoutCanvas.children);
|
|
87
|
-
if (captureElements.length !==
|
|
118
|
+
if (captureElements.length !== renderedSampleCount ||
|
|
88
119
|
captureElements[0] !== element) {
|
|
89
120
|
throw new Error('Motion blur samples are not ready to paint');
|
|
90
121
|
}
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
122
|
+
if (actualSamples === 1) {
|
|
123
|
+
(_a = compositorRef.current) === null || _a === void 0 ? void 0 : _a.compositor.dispose();
|
|
124
|
+
compositorRef.current = null;
|
|
125
|
+
context.reset();
|
|
126
|
+
context.drawElementImage(elementImage, 0, 0);
|
|
127
|
+
return;
|
|
95
128
|
}
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
129
|
+
const preferWebGl = (preferredBackend !== null && preferredBackend !== void 0 ? preferredBackend : window.remotion_preferredEffectBackend) ===
|
|
130
|
+
'webgl2' || Boolean(window.remotion_disableWebGpuEffects);
|
|
131
|
+
if ((_b = compositorRef.current) === null || _b === void 0 ? void 0 : _b.compositor.isLost()) {
|
|
132
|
+
if (compositorRef.current.compositor.backend === 'webgpu') {
|
|
133
|
+
gpuDeviceRef.current = null;
|
|
134
|
+
}
|
|
135
|
+
compositorRef.current.compositor.dispose();
|
|
136
|
+
compositorRef.current = null;
|
|
137
|
+
}
|
|
138
|
+
if (compositorRef.current === null ||
|
|
139
|
+
compositorRef.current.width !== canvas.width ||
|
|
140
|
+
compositorRef.current.height !== canvas.height ||
|
|
141
|
+
compositorRef.current.preferWebGl !== preferWebGl) {
|
|
142
|
+
(_c = compositorRef.current) === null || _c === void 0 ? void 0 : _c.compositor.dispose();
|
|
143
|
+
compositorRef.current = null;
|
|
144
|
+
const createdCompositor = (0, motion_blur_compositor_1.createMotionBlurCompositor)({
|
|
145
|
+
width: canvas.width,
|
|
146
|
+
height: canvas.height,
|
|
147
|
+
device: preferWebGl ? null : gpuDeviceRef.current,
|
|
148
|
+
requestPaint: () => { var _a; return (_a = layoutCanvas.requestPaint) === null || _a === void 0 ? void 0 : _a.call(layoutCanvas); },
|
|
149
|
+
});
|
|
150
|
+
compositorRef.current = {
|
|
151
|
+
compositor: createdCompositor,
|
|
152
|
+
width: canvas.width,
|
|
153
|
+
height: canvas.height,
|
|
154
|
+
preferWebGl,
|
|
155
|
+
};
|
|
104
156
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const image = index === 0
|
|
110
|
-
? elementImage
|
|
111
|
-
: layoutCanvas.captureElementImage(sampleElement);
|
|
157
|
+
const { compositor } = compositorRef.current;
|
|
158
|
+
const sampleWeight = 1 / actualSamples;
|
|
159
|
+
for (const [index, sampleElement] of captureElements.slice(1).entries()) {
|
|
160
|
+
const image = layoutCanvas.captureElementImage(sampleElement);
|
|
112
161
|
try {
|
|
113
162
|
// ElementImage can only be drawn back to its originating canvas.
|
|
114
163
|
context.reset();
|
|
115
164
|
context.drawElementImage(image, 0, 0);
|
|
116
|
-
|
|
165
|
+
compositor.addSample(canvas, index, sampleWeight);
|
|
117
166
|
}
|
|
118
167
|
finally {
|
|
119
|
-
|
|
120
|
-
image.close();
|
|
121
|
-
}
|
|
168
|
+
image.close();
|
|
122
169
|
}
|
|
123
170
|
}
|
|
124
171
|
context.reset();
|
|
125
|
-
context.drawImage(
|
|
126
|
-
}, [actualSamples]);
|
|
172
|
+
context.drawImage(compositor.finish(), 0, 0);
|
|
173
|
+
}, [actualSamples, preferredBackend, renderedSampleCount]);
|
|
127
174
|
const passThrough = remotion_1.Internals.useHtmlInCanvasUnsupportedMessage() !== null;
|
|
128
|
-
|
|
129
|
-
return
|
|
175
|
+
if (registry === null)
|
|
176
|
+
return null;
|
|
177
|
+
const sampleElements = Array.from({ length: passThrough ? 0 : renderedSampleCount }, (_, index) => {
|
|
178
|
+
return ((0, jsx_runtime_1.jsx)(MotionBlurSample, { width: width, height: height, index: index, count: actualSamples, shutterInFrames: shutterInFrames, firstFrame: firstFrame, lastFrame: lastFrame, registry: registry, children: children }, index));
|
|
130
179
|
});
|
|
131
180
|
// The root wrapper holds the first sample. The rest must be canvas children.
|
|
132
181
|
// Reuse HtmlInCanvas's Sequence for the motion blur controls.
|
|
133
|
-
return ((0, jsx_runtime_1.jsx)(remotion_1.HtmlInCanvas, { width: width, height: height, from: from, durationInFrames: durationInFrames, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<HtmlInCanvasMotionBlur>', premountFor: premountFor, postmountFor: postmountFor, showInTimeline: showInTimeline, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, controls, onPaint: onPaint, _remotionInternalCanvasSiblings: sampleElements.slice(1), _remotionInternalFallbackLabel: "Motion blur is not visible", children: passThrough ? children : sampleElements[0] }));
|
|
182
|
+
return ((0, jsx_runtime_1.jsx)(remotion_1.HtmlInCanvas, { width: width, height: height, from: from, durationInFrames: durationInFrames, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, name: name !== null && name !== void 0 ? name : '<HtmlInCanvasMotionBlur>', premountFor: premountFor, postmountFor: postmountFor, showInTimeline: showInTimeline, style: style, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, controls, onPaint: onPaint, onInit: onInit, _remotionInternalCanvasSiblings: sampleElements.slice(1), _remotionInternalFallbackLabel: "Motion blur is not visible", children: passThrough ? children : sampleElements[0] }));
|
|
134
183
|
};
|
|
135
184
|
/**
|
|
136
185
|
* Experimental motion blur that averages separately captured HTML-in-canvas
|
package/dist/cjs/Trail.js
CHANGED
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Trail = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const motion_blur_context_1 = require("./motion-blur-context");
|
|
6
7
|
/*
|
|
7
8
|
* @description The <Trail> component duplicates its children and adds a time offset to each layer in order to create a trail effect.
|
|
8
9
|
* @see [Documentation](https://www.remotion.dev/docs/motion-blur/trail)
|
|
9
10
|
*/
|
|
10
11
|
const Trail = ({ children, layers, lagInFrames, trailOpacity, }) => {
|
|
11
12
|
const frame = (0, remotion_1.useCurrentFrame)();
|
|
13
|
+
const registry = (0, motion_blur_context_1.useMotionBlurRegistry)('Trail');
|
|
12
14
|
if (typeof layers !== 'number' ||
|
|
13
15
|
Number.isNaN(layers) ||
|
|
14
16
|
!Number.isFinite(layers)) {
|
|
@@ -30,10 +32,12 @@ const Trail = ({ children, layers, lagInFrames, trailOpacity, }) => {
|
|
|
30
32
|
!Number.isFinite(lagInFrames)) {
|
|
31
33
|
throw new TypeError(`"lagInFrames" must be a number, but got ${JSON.stringify(lagInFrames)}`);
|
|
32
34
|
}
|
|
35
|
+
if (registry === null)
|
|
36
|
+
return null;
|
|
33
37
|
return ((0, jsx_runtime_1.jsxs)(remotion_1.AbsoluteFill, { children: [new Array(layers).fill(true).map((_, i) => {
|
|
34
38
|
return ((0, jsx_runtime_1.jsx)(remotion_1.AbsoluteFill, { style: {
|
|
35
39
|
opacity: trailOpacity - ((layers - i) / layers) * trailOpacity,
|
|
36
|
-
}, children: (0, jsx_runtime_1.jsx)(remotion_1.Freeze, { frame: frame - lagInFrames * (layers - i), children: children }) }, `frame-${i.toString()}`));
|
|
37
|
-
}), children] }));
|
|
40
|
+
}, children: (0, jsx_runtime_1.jsx)(remotion_1.Freeze, { frame: frame - lagInFrames * (layers - i), children: (0, jsx_runtime_1.jsx)(motion_blur_context_1.MotionBlurSampleProvider, { sampleIndex: i + 1, registry: registry, children: children }) }) }, `frame-${i.toString()}`));
|
|
41
|
+
}), (0, jsx_runtime_1.jsx)(motion_blur_context_1.MotionBlurSampleProvider, { sampleIndex: 0, registry: registry, children: children })] }));
|
|
38
42
|
};
|
|
39
43
|
exports.Trail = Trail;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { createMotionBlurCompositor, getMotionBlurGpuDevice } from './motion-blur-compositor';
|
|
1
2
|
export { CameraMotionBlur, CameraMotionBlurProps } from './CameraMotionBlur';
|
|
2
3
|
export { HtmlInCanvasMotionBlur, HtmlInCanvasMotionBlurProps, } from './HtmlInCanvasMotionBlur';
|
|
3
4
|
export { Trail, TrailProps } from './Trail';
|
|
5
|
+
export declare const MotionBlurInternals: {
|
|
6
|
+
createMotionBlurCompositor: typeof createMotionBlurCompositor;
|
|
7
|
+
getMotionBlurGpuDevice: typeof getMotionBlurGpuDevice;
|
|
8
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Trail = exports.HtmlInCanvasMotionBlur = exports.CameraMotionBlur = void 0;
|
|
3
|
+
exports.MotionBlurInternals = exports.Trail = exports.HtmlInCanvasMotionBlur = exports.CameraMotionBlur = void 0;
|
|
4
|
+
const motion_blur_compositor_1 = require("./motion-blur-compositor");
|
|
4
5
|
var CameraMotionBlur_1 = require("./CameraMotionBlur");
|
|
5
6
|
Object.defineProperty(exports, "CameraMotionBlur", { enumerable: true, get: function () { return CameraMotionBlur_1.CameraMotionBlur; } });
|
|
6
7
|
var HtmlInCanvasMotionBlur_1 = require("./HtmlInCanvasMotionBlur");
|
|
7
8
|
Object.defineProperty(exports, "HtmlInCanvasMotionBlur", { enumerable: true, get: function () { return HtmlInCanvasMotionBlur_1.HtmlInCanvasMotionBlur; } });
|
|
8
9
|
var Trail_1 = require("./Trail");
|
|
9
10
|
Object.defineProperty(exports, "Trail", { enumerable: true, get: function () { return Trail_1.Trail; } });
|
|
11
|
+
exports.MotionBlurInternals = {
|
|
12
|
+
createMotionBlurCompositor: motion_blur_compositor_1.createMotionBlurCompositor,
|
|
13
|
+
getMotionBlurGpuDevice: motion_blur_compositor_1.getMotionBlurGpuDevice,
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Compositor = {
|
|
2
|
+
readonly backend: 'webgpu' | 'webgl2';
|
|
3
|
+
readonly addSample: (source: OffscreenCanvas, index: number, weight: number) => void;
|
|
4
|
+
readonly finish: () => HTMLCanvasElement;
|
|
5
|
+
readonly dispose: () => void;
|
|
6
|
+
readonly isLost: () => boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const getMotionBlurGpuDevice: () => Promise<GPUDevice | null>;
|
|
9
|
+
export declare const createMotionBlurCompositor: ({ width, height, device, requestPaint, }: {
|
|
10
|
+
readonly width: number;
|
|
11
|
+
readonly height: number;
|
|
12
|
+
readonly device: GPUDevice | null;
|
|
13
|
+
readonly requestPaint: () => void;
|
|
14
|
+
}) => Compositor;
|
|
15
|
+
export {};
|