Skip to main content

noise2D()

Part of the @remotion/noise package.

Creates 2D noise.

API

The function takes three arguments:

seed

Pass any string or number. If the seed is the same, you will get the same result for same x and y values. Change the seed to to get different results for your x and y values.

x

number

The first dimensional value.

y

number

The second dimensional value.

Return value

A value between -1 and 1, swinging as your x and y values change.

Example

tsx
import { noise2D } from "@remotion/noise";
 
const x = 32;
const y = 40;
console.log(noise2D("my-seed", x, y)); // a number in the interval [-1, 1] which corresponds to (x, y) coord.
tsx
import { noise2D } from "@remotion/noise";
 
const x = 32;
const y = 40;
console.log(noise2D("my-seed", x, y)); // a number in the interval [-1, 1] which corresponds to (x, y) coord.

Credits

Uses the simplex-noise dependency

See also