@remotion/motion-blur 4.0.142 → 4.0.144
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/LICENSE.md +4 -0
- package/bundle.ts +16 -0
- package/dist/esm/index.mjs +105 -86
- package/package.json +4 -6
- package/dist/esm/CameraMotionBlur.d.ts +0 -11
- package/dist/esm/Trail.d.ts +0 -12
- package/dist/esm/index.d.ts +0 -2
package/LICENSE.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Remotion License
|
|
2
2
|
|
|
3
|
+
In Remotion 5.0, the license will slightly change. [View the changes here](https://github.com/remotion-dev/remotion/pull/3750).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
3
7
|
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
4
8
|
|
|
5
9
|
- [Free license](#free-license)
|
package/bundle.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {build} from 'bun';
|
|
2
|
+
|
|
3
|
+
const output = await build({
|
|
4
|
+
entrypoints: ['src/index.ts'],
|
|
5
|
+
naming: '[name].mjs',
|
|
6
|
+
external: ['react', 'remotion', 'remotion/no-react', 'react/jsx-runtime'],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const [file] = output.outputs;
|
|
10
|
+
const text = (await file.text())
|
|
11
|
+
.replace(/jsxDEV/g, 'jsx')
|
|
12
|
+
.replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
|
|
13
|
+
|
|
14
|
+
await Bun.write('dist/esm/index.mjs', text);
|
|
15
|
+
|
|
16
|
+
export {};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,90 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
// src/CameraMotionBlur.tsx
|
|
2
|
+
import {AbsoluteFill, Freeze, useCurrentFrame} from "remotion";
|
|
3
|
+
import {
|
|
4
|
+
jsx
|
|
5
|
+
} from "react/jsx-runtime";
|
|
6
|
+
var getNumberOfSamples = ({
|
|
7
|
+
shutterFraction,
|
|
8
|
+
samples,
|
|
9
|
+
currentFrame
|
|
10
|
+
}) => {
|
|
11
|
+
const maxOffset = shutterFraction * samples;
|
|
12
|
+
const maxTimeReverse = currentFrame - maxOffset;
|
|
13
|
+
const factor = Math.min(1, Math.max(0, maxTimeReverse / maxOffset + 1));
|
|
14
|
+
return Math.max(1, Math.round(Math.min(factor * samples, samples)));
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
16
|
+
var CameraMotionBlur = ({
|
|
17
|
+
children,
|
|
18
|
+
shutterAngle = 180,
|
|
19
|
+
samples = 10
|
|
20
|
+
}) => {
|
|
21
|
+
const currentFrame = useCurrentFrame();
|
|
22
|
+
if (typeof samples !== "number" || Number.isNaN(samples) || !Number.isFinite(samples)) {
|
|
23
|
+
throw new TypeError(`"samples" must be a number, but got ${JSON.stringify(samples)}`);
|
|
24
|
+
}
|
|
25
|
+
if (samples % 1 !== 0) {
|
|
26
|
+
throw new TypeError(`"samples" must be an integer, but got ${JSON.stringify(samples)}`);
|
|
27
|
+
}
|
|
28
|
+
if (samples < 0) {
|
|
29
|
+
throw new TypeError(`"samples" must be non-negative, but got ${JSON.stringify(samples)}`);
|
|
30
|
+
}
|
|
31
|
+
if (typeof shutterAngle !== "number" || Number.isNaN(shutterAngle) || !Number.isFinite(shutterAngle)) {
|
|
32
|
+
throw new TypeError(`"shutterAngle" must be a number, but got ${JSON.stringify(shutterAngle)}`);
|
|
33
|
+
}
|
|
34
|
+
if (shutterAngle < 0 || shutterAngle > 360) {
|
|
35
|
+
throw new TypeError(`"shutterAngle" must be between 0 and 360, but got ${JSON.stringify(shutterAngle)}`);
|
|
36
|
+
}
|
|
37
|
+
const shutterFraction = shutterAngle / 360;
|
|
38
|
+
const actualSamples = getNumberOfSamples({
|
|
39
|
+
currentFrame,
|
|
40
|
+
samples,
|
|
41
|
+
shutterFraction
|
|
42
|
+
});
|
|
43
|
+
return jsx(AbsoluteFill, {
|
|
44
|
+
style: { isolation: "isolate" },
|
|
45
|
+
children: new Array(actualSamples).fill(true).map((_, i) => {
|
|
46
|
+
const sample = i + 1;
|
|
47
|
+
const sampleFrameOffset = shutterFraction * (sample / actualSamples);
|
|
48
|
+
return jsx(AbsoluteFill, {
|
|
49
|
+
style: {
|
|
50
|
+
mixBlendMode: "plus-lighter",
|
|
51
|
+
filter: `opacity(${1 / actualSamples})`
|
|
52
|
+
},
|
|
53
|
+
children: jsx(Freeze, {
|
|
54
|
+
frame: currentFrame - sampleFrameOffset + 1,
|
|
55
|
+
children
|
|
56
|
+
}, undefined, false, undefined, this)
|
|
57
|
+
}, `frame-${i.toString()}`, false, undefined, this);
|
|
58
|
+
})
|
|
59
|
+
}, undefined, false, undefined, this);
|
|
54
60
|
};
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
62
|
+
// src/Trail.tsx
|
|
63
|
+
import {AbsoluteFill as AbsoluteFill2, Freeze as Freeze2, useCurrentFrame as useCurrentFrame2} from "remotion";
|
|
64
|
+
import {
|
|
65
|
+
jsx as jsx2
|
|
66
|
+
} from "react/jsx-runtime";
|
|
67
|
+
var Trail = ({
|
|
68
|
+
children,
|
|
69
|
+
layers,
|
|
70
|
+
lagInFrames,
|
|
71
|
+
trailOpacity
|
|
72
|
+
}) => {
|
|
73
|
+
const frame = useCurrentFrame2();
|
|
74
|
+
if (typeof layers !== "number" || Number.isNaN(layers) || !Number.isFinite(layers)) {
|
|
75
|
+
throw new TypeError(`"layers" must be a number, but got ${JSON.stringify(layers)}`);
|
|
76
|
+
}
|
|
77
|
+
if (layers % 1 !== 0) {
|
|
78
|
+
throw new TypeError(`"layers" must be an integer, but got ${JSON.stringify(layers)}`);
|
|
79
|
+
}
|
|
80
|
+
if (layers < 0) {
|
|
81
|
+
throw new TypeError(`"layers" must be non-negative, but got ${JSON.stringify(layers)}`);
|
|
82
|
+
}
|
|
83
|
+
if (typeof trailOpacity !== "number" || Number.isNaN(trailOpacity) || !Number.isFinite(trailOpacity)) {
|
|
84
|
+
throw new TypeError(`"trailOpacity" must be a number, but got ${JSON.stringify(trailOpacity)}`);
|
|
85
|
+
}
|
|
86
|
+
if (typeof lagInFrames !== "number" || Number.isNaN(lagInFrames) || !Number.isFinite(lagInFrames)) {
|
|
87
|
+
throw new TypeError(`"lagInFrames" must be a number, but got ${JSON.stringify(lagInFrames)}`);
|
|
88
|
+
}
|
|
89
|
+
return jsx2(AbsoluteFill2, {
|
|
90
|
+
children: [
|
|
91
|
+
new Array(layers).fill(true).map((_, i) => {
|
|
92
|
+
return jsx2(AbsoluteFill2, {
|
|
93
|
+
style: {
|
|
94
|
+
opacity: trailOpacity - (layers - i) / layers * trailOpacity
|
|
95
|
+
},
|
|
96
|
+
children: jsx2(Freeze2, {
|
|
97
|
+
frame: frame - lagInFrames * (layers - i),
|
|
98
|
+
children
|
|
99
|
+
}, undefined, false, undefined, this)
|
|
100
|
+
}, `frame-${i.toString()}`, false, undefined, this);
|
|
101
|
+
}),
|
|
102
|
+
children
|
|
103
|
+
]
|
|
104
|
+
}, undefined, true, undefined, this);
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
Trail,
|
|
108
|
+
CameraMotionBlur
|
|
88
109
|
};
|
|
89
|
-
|
|
90
|
-
export { CameraMotionBlur, Trail };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/motion-blur",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.144",
|
|
4
4
|
"description": "Motion blur effect for Remotion",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"remotion": "4.0.
|
|
19
|
+
"remotion": "4.0.144"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"react": ">=16.8.0",
|
|
@@ -33,15 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.281",
|
|
36
|
-
"@rollup/plugin-typescript": "^8.2.0",
|
|
37
36
|
"@types/react": "18.2.48",
|
|
38
37
|
"eslint": "8.56.0",
|
|
39
38
|
"prettier": "3.2.5",
|
|
40
39
|
"prettier-plugin-organize-imports": "3.2.4",
|
|
41
40
|
"react": "18.2.0",
|
|
42
41
|
"react-dom": "18.2.0",
|
|
43
|
-
"
|
|
44
|
-
"remotion": "4.0.142"
|
|
42
|
+
"remotion": "4.0.144"
|
|
45
43
|
},
|
|
46
44
|
"keywords": [
|
|
47
45
|
"remotion",
|
|
@@ -55,6 +53,6 @@
|
|
|
55
53
|
"formatting": "prettier src --check",
|
|
56
54
|
"lint": "eslint src --ext ts,tsx",
|
|
57
55
|
"watch": "tsc -w",
|
|
58
|
-
"build": "
|
|
56
|
+
"build": "bun bundle.ts && tsc -d"
|
|
59
57
|
}
|
|
60
58
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type CameraMotionBlurProps = {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
shutterAngle?: number;
|
|
5
|
-
samples?: number;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @description Produces natural looking motion blur similar to what would be produced by a film camera.
|
|
9
|
-
* @see [Documentation](https://www.remotion.dev/docs/motion-blur/camera-motion-blur)
|
|
10
|
-
*/
|
|
11
|
-
export declare const CameraMotionBlur: React.FC<CameraMotionBlurProps>;
|
package/dist/esm/Trail.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type TrailProps = {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
layers: number;
|
|
5
|
-
lagInFrames: number;
|
|
6
|
-
trailOpacity: number;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* @description The <Trail> component duplicates it's children and adds a time offset to each layer in order to create a trail effect.
|
|
10
|
-
* @see [Documentation](https://www.remotion.dev/docs/motion-blur/trail)
|
|
11
|
-
*/
|
|
12
|
-
export declare const Trail: React.FC<TrailProps>;
|
package/dist/esm/index.d.ts
DELETED