@remotion/motion-blur 4.0.545 → 4.0.547

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.
@@ -1,6 +1,6 @@
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;
@@ -8,6 +8,7 @@ const motion_blur_compositor_1 = require("./motion-blur-compositor");
8
8
  const motion_blur_context_1 = require("./motion-blur-context");
9
9
  const htmlInCanvasMotionBlurSchema = {
10
10
  ...remotion_1.Interactive.baseSchema,
11
+ ...remotion_1.Interactive.transformSchema,
11
12
  shutterAngle: {
12
13
  type: 'number',
13
14
  min: 0,
@@ -60,8 +61,11 @@ const MotionBlurSample = ({ children, width, height, index, count, shutterInFram
60
61
  pointerEvents: isRepresentativeSample ? 'auto' : 'none',
61
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 }) }) }));
62
63
  };
63
- const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 180, samples = 8, disabled = false, disabledInPreview = 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, }) => {
65
+ var _a;
66
+ var _b;
64
67
  const { durationInFrames: compositionDurationInFrames } = (0, remotion_1.useVideoConfig)();
68
+ const parentTrimBefore = (_b = (_a = (0, react_1.useContext)(remotion_1.Internals.SequenceContext)) === null || _a === void 0 ? void 0 : _a.trimBefore) !== null && _b !== void 0 ? _b : 0;
65
69
  const { isRendering } = (0, remotion_1.useRemotionEnvironment)();
66
70
  const videoEnabled = remotion_1.Internals.useVideoEnabled();
67
71
  const preferredBackend = (0, react_1.useContext)(remotion_1.Internals.PreferredEffectBackendContext);
@@ -92,7 +96,7 @@ const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 1
92
96
  durationInFrames,
93
97
  playbackRate,
94
98
  loop,
95
- }), compositionDurationInFrames - (from !== null && from !== void 0 ? from : 0)));
99
+ }), compositionDurationInFrames + parentTrimBefore - (from !== null && from !== void 0 ? from : 0)));
96
100
  const lastFrame = firstFrame + Math.max(0, visibleDuration - 1) * (playbackRate !== null && playbackRate !== void 0 ? playbackRate : 1);
97
101
  const onInit = (0, react_1.useCallback)(async () => {
98
102
  gpuDeviceRef.current = await (0, motion_blur_compositor_1.getMotionBlurGpuDevice)();
@@ -154,8 +158,7 @@ const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 1
154
158
  };
155
159
  }
156
160
  const { compositor } = compositorRef.current;
157
- // Canvas2D quantizes globalAlpha to eight bits, including float16 targets.
158
- const sampleWeight = Math.round(255 / actualSamples) / 255;
161
+ const sampleWeight = 1 / actualSamples;
159
162
  for (const [index, sampleElement] of captureElements.slice(1).entries()) {
160
163
  const image = layoutCanvas.captureElementImage(sampleElement);
161
164
  try {
@@ -179,7 +182,7 @@ const HtmlInCanvasMotionBlurInner = ({ children, width, height, shutterAngle = 1
179
182
  });
180
183
  // The root wrapper holds the first sample. The rest must be canvas children.
181
184
  // Reuse HtmlInCanvas's Sequence for the motion blur controls.
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, styleWhilePremounted: styleWhilePremounted, styleWhilePostmounted: styleWhilePostmounted, controls, onPaint: onPaint, onInit: onInit, _remotionInternalCanvasSiblings: sampleElements.slice(1), _remotionInternalFallbackLabel: "Motion blur is not visible", children: passThrough ? children : sampleElements[0] }));
185
+ 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] }));
183
186
  };
184
187
  /**
185
188
  * Experimental motion blur that averages separately captured HTML-in-canvas
@@ -494,6 +494,7 @@ import {
494
494
  import { jsx as jsx3 } from "react/jsx-runtime";
495
495
  var htmlInCanvasMotionBlurSchema = {
496
496
  ...Interactive.baseSchema,
497
+ ...Interactive.transformSchema,
497
498
  shutterAngle: {
498
499
  type: "number",
499
500
  min: 0,
@@ -582,11 +583,13 @@ var HtmlInCanvasMotionBlurInner = ({
582
583
  premountFor,
583
584
  postmountFor,
584
585
  showInTimeline,
586
+ style,
585
587
  styleWhilePremounted,
586
588
  styleWhilePostmounted,
587
589
  controls
588
590
  }) => {
589
591
  const { durationInFrames: compositionDurationInFrames } = useVideoConfig();
592
+ const parentTrimBefore = useContext2(Internals3.SequenceContext)?.trimBefore ?? 0;
590
593
  const { isRendering } = useRemotionEnvironment();
591
594
  const videoEnabled = Internals3.useVideoEnabled();
592
595
  const preferredBackend = useContext2(Internals3.PreferredEffectBackendContext);
@@ -607,7 +610,7 @@ var HtmlInCanvasMotionBlurInner = ({
607
610
  durationInFrames,
608
611
  playbackRate,
609
612
  loop
610
- }), compositionDurationInFrames - (from ?? 0)));
613
+ }), compositionDurationInFrames + parentTrimBefore - (from ?? 0)));
611
614
  const lastFrame = firstFrame + Math.max(0, visibleDuration - 1) * (playbackRate ?? 1);
612
615
  const onInit = useCallback(async () => {
613
616
  gpuDeviceRef.current = await getMotionBlurGpuDevice();
@@ -662,7 +665,7 @@ var HtmlInCanvasMotionBlurInner = ({
662
665
  };
663
666
  }
664
667
  const { compositor } = compositorRef.current;
665
- const sampleWeight = Math.round(255 / actualSamples) / 255;
668
+ const sampleWeight = 1 / actualSamples;
666
669
  for (const [index, sampleElement] of captureElements.slice(1).entries()) {
667
670
  const image = layoutCanvas.captureElementImage(sampleElement);
668
671
  try {
@@ -706,6 +709,7 @@ var HtmlInCanvasMotionBlurInner = ({
706
709
  premountFor,
707
710
  postmountFor,
708
711
  showInTimeline,
712
+ style,
709
713
  styleWhilePremounted,
710
714
  styleWhilePostmounted,
711
715
  ...{ controls },
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/motion-blur"
4
4
  },
5
5
  "name": "@remotion/motion-blur",
6
- "version": "4.0.545",
6
+ "version": "4.0.547",
7
7
  "description": "Motion blur effect for Remotion",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "url": "https://github.com/remotion-dev/remotion/issues"
22
22
  },
23
23
  "dependencies": {
24
- "remotion": "4.0.545"
24
+ "remotion": "4.0.547"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": ">=16.8.0",
@@ -40,8 +40,8 @@
40
40
  "@webgpu/types": "0.1.74",
41
41
  "react": "19.3.1",
42
42
  "react-dom": "19.3.1",
43
- "remotion": "4.0.545",
44
- "@remotion/eslint-config-internal": "4.0.545",
43
+ "remotion": "4.0.547",
44
+ "@remotion/eslint-config-internal": "4.0.547",
45
45
  "eslint": "9.19.0",
46
46
  "typescript": "7.1.0-beta"
47
47
  },