noise2D()
属于 @remotion/noise 软件包的一部分.
🌐 Part of the @remotion/noise package.
创建二维噪声。
🌐 Creates 2D noise.
应用编程接口
🌐 API
该函数接受三个参数:
🌐 The function takes three arguments:
seed
传入任意 string 或 number。如果种子相同,对于相同的 x 和 y 值,你将得到相同的结果。更改种子可以获得 x 和 y 值的不同结果。
🌐 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 get different results for your x and y values.
x
number
第一个维度值。
🌐 The first dimensional value.
y
number
第二维度的值。
🌐 The second dimensional value.
返回值
🌐 Return value
一个介于 -1 和 1 之间的值,随着你的 x 和 y 值的变化而摆动。
🌐 A value between -1 and 1, swinging as your x and y values change.
示例
🌐 Example
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
使用 simplex-noise 依赖
🌐 Uses the simplex-noise dependency
另请参阅
🌐 See also