@remotion/noise 3.2.32

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/.prettierrc.js ADDED
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ singleQuote: true,
3
+ bracketSpacing: false,
4
+ useTabs: true,
5
+ overrides: [
6
+ {
7
+ files: ['*.yml'],
8
+ options: {
9
+ singleQuote: false,
10
+ },
11
+ },
12
+ ],
13
+ plugins: [require.resolve('prettier-plugin-organize-imports')],
14
+ };
package/LICENSE.md ADDED
@@ -0,0 +1,41 @@
1
+ # Remotion License
2
+
3
+ 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 create videos for free (even commercial), while a company license is required for for-profit organisations 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
+
5
+ - [Free license](#free-license)
6
+ - [Company license](#company-license)
7
+
8
+ ## Free license
9
+
10
+ Copyright © 2022 [Jonny Burger](https://jonny.io)
11
+
12
+ ### Eligibility
13
+
14
+ You are eligible to use Remotion for free if you are:
15
+
16
+ - an individual
17
+ - a for-profit organisation with up to 3 employees
18
+ - a non-profit or not-for-profit organisation
19
+ - evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
20
+
21
+ ### Allowed use cases
22
+
23
+ Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify and the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
24
+
25
+ ### Disallowed use cases
26
+
27
+ It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
28
+
29
+ ### Warranty notice
30
+
31
+ The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
32
+
33
+ ### Support
34
+
35
+ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
36
+
37
+ ## Company license
38
+
39
+ You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
40
+
41
+ Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ This package offers a Noise effect for Remotion.
2
+
3
+ **Documentation: https://remotion.dev/noise**
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @description Creates 2D noise.
3
+ * @link https://remotion.dev/docs/noise/noise-2d
4
+ * @param {string | number} seed Seed value for deterministic results
5
+ * @param {number} x First dimensional value
6
+ * @param {number} y Second dimensional value
7
+ * @returns {number} Between -1 and 1
8
+ */
9
+ export declare const noise2D: (seed: string | number, x: number, y: number) => number;
10
+ /**
11
+ * @description Creates 3D noise.
12
+ * @link https://remotion.dev/docs/noise/noise-3d
13
+ * @param {string | number} seed Seed value for deterministic results
14
+ * @param {number} x First dimensional value
15
+ * @param {number} y Second dimensional value
16
+ * @param {number} z Third dimensional value
17
+ * @returns {number} Between -1 and 1
18
+ */
19
+ export declare const noise3D: (seed: string | number, x: number, y: number, z: number) => number;
20
+ /**
21
+ * @description Creates 4D noise.
22
+ * @link https://remotion.dev/docs/noise/noise-4d
23
+ * @param {string | number} seed Seed value for deterministic results
24
+ * @param {number} x First dimensional value
25
+ * @param {number} y Second dimensional value
26
+ * @param {number} z Third dimensional value
27
+ * @param {number} w Fourth dimensional value
28
+ * @returns {number} Between -1 and 1
29
+ */
30
+ export declare const noise4D: (seed: string | number, x: number, y: number, z: number, w: number) => number;
package/dist/index.js ADDED
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noise4D = exports.noise3D = exports.noise2D = void 0;
4
+ const remotion_1 = require("remotion");
5
+ const simplex_noise_1 = require("simplex-noise");
6
+ const seedCache2d = new Map();
7
+ const seedCache3d = new Map();
8
+ const seedCache4d = new Map();
9
+ const generate2DNoise = (seed) => {
10
+ const cached = seedCache2d.get(seed);
11
+ if (cached) {
12
+ return cached;
13
+ }
14
+ // If the cache is getting to big, remove entries based on FIFO principle
15
+ if (seedCache2d.size > 10) {
16
+ seedCache2d.delete(seedCache2d.keys().next().value);
17
+ }
18
+ const noise = (0, simplex_noise_1.createNoise2D)(() => (0, remotion_1.random)(seed));
19
+ seedCache2d.set(seed, noise);
20
+ return noise;
21
+ };
22
+ const generate3DNoise = (seed) => {
23
+ const cached = seedCache3d.get(seed);
24
+ if (cached) {
25
+ return cached;
26
+ }
27
+ // If the cache is getting to big, remove entries based on FIFO principle
28
+ if (seedCache3d.size > 10) {
29
+ seedCache3d.delete(seedCache3d.keys().next().value);
30
+ }
31
+ const noise = (0, simplex_noise_1.createNoise3D)(() => (0, remotion_1.random)(seed));
32
+ seedCache3d.set(seed, noise);
33
+ return noise;
34
+ };
35
+ const generate4DNoise = (seed) => {
36
+ const cached = seedCache4d.get(seed);
37
+ if (cached) {
38
+ return cached;
39
+ }
40
+ // If the cache is getting to big, remove entries based on FIFO principle
41
+ if (seedCache4d.size > 10) {
42
+ seedCache4d.delete(seedCache4d.keys().next().value);
43
+ }
44
+ const noise = (0, simplex_noise_1.createNoise4D)(() => (0, remotion_1.random)(seed));
45
+ seedCache4d.set(seed, noise);
46
+ return noise;
47
+ };
48
+ /**
49
+ * @description Creates 2D noise.
50
+ * @link https://remotion.dev/docs/noise/noise-2d
51
+ * @param {string | number} seed Seed value for deterministic results
52
+ * @param {number} x First dimensional value
53
+ * @param {number} y Second dimensional value
54
+ * @returns {number} Between -1 and 1
55
+ */
56
+ const noise2D = (seed, x, y) => {
57
+ return generate2DNoise(seed)(x, y);
58
+ };
59
+ exports.noise2D = noise2D;
60
+ /**
61
+ * @description Creates 3D noise.
62
+ * @link https://remotion.dev/docs/noise/noise-3d
63
+ * @param {string | number} seed Seed value for deterministic results
64
+ * @param {number} x First dimensional value
65
+ * @param {number} y Second dimensional value
66
+ * @param {number} z Third dimensional value
67
+ * @returns {number} Between -1 and 1
68
+ */
69
+ const noise3D = (seed, x, y, z) => generate3DNoise((0, remotion_1.random)(seed))(x, y, z);
70
+ exports.noise3D = noise3D;
71
+ /**
72
+ * @description Creates 4D noise.
73
+ * @link https://remotion.dev/docs/noise/noise-4d
74
+ * @param {string | number} seed Seed value for deterministic results
75
+ * @param {number} x First dimensional value
76
+ * @param {number} y Second dimensional value
77
+ * @param {number} z Third dimensional value
78
+ * @param {number} w Fourth dimensional value
79
+ * @returns {number} Between -1 and 1
80
+ */
81
+ const noise4D = (seed, x, y, z, w
82
+ // eslint-disable-next-line max-params
83
+ ) => generate4DNoise((0, remotion_1.random)(seed))(x, y, z, w);
84
+ exports.noise4D = noise4D;
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@remotion/noise",
3
+ "version": "3.2.32",
4
+ "description": "Noise effect for Remotion",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "sideEffects": false,
8
+ "scripts": {
9
+ "lint": "eslint src --ext ts,tsx",
10
+ "watch": "tsc -w",
11
+ "build": "tsc -d",
12
+ "test": "vitest --run"
13
+ },
14
+ "author": "Yehor Misiats (https://github.com/satelllte)",
15
+ "maintainers": [
16
+ "Jonny Burger <jonny@remotion.dev>",
17
+ "Yehor Misiats (https://github.com/satelllte)"
18
+ ],
19
+ "contributors": [],
20
+ "license": "MIT",
21
+ "repository": {
22
+ "url": "https://github.com/remotion-dev/remotion"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/remotion-dev/remotion/issues"
26
+ },
27
+ "dependencies": {
28
+ "remotion": "3.2.32",
29
+ "simplex-noise": "4.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@jonny/eslint-config": "^3.0.266",
33
+ "@types/node": "^16.7.5",
34
+ "eslint": "8.13.0",
35
+ "prettier": "^2.0.5",
36
+ "prettier-plugin-organize-imports": "^2.3.4",
37
+ "typescript": "^4.7.0",
38
+ "vitest": "0.18.0"
39
+ },
40
+ "keywords": [
41
+ "remotion",
42
+ "noise"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "gitHead": "4f7ab3637405d140041f898f95f78c99943d1b40"
48
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../tsconfig.settings.json",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "rootDir": "src",
6
+ "outDir": "dist",
7
+ "skipLibCheck": true
8
+ },
9
+ "include": ["src"],
10
+ "references": [
11
+ {
12
+ "path": "../core"
13
+ }
14
+ ]
15
+ }