noise

def setup
  @xoff = 0.0
end

def draw
  background(204)
  @xoff = @xoff + 0.01
  n = noise(@xoff) * width
  line(n, 0, n, height)
end
def setup
  @noiseScale=0.02
end

def draw
  background(255)
  (0...width).each do |x|
    noiseVal = noise((mouseX + x) * @noiseScale, mouseY * @noiseScale)
    stroke(noiseVal * 255)
    line(x, mouseY + noiseVal * 80, x, height)
  end
end

p5.jsリファレンス(参考情報)

[p5.js] noise

概要

指定された座標でのパーリンノイズ値を返します。

書式

noise(x [, y] [, z])

引数

引数名内容備考オプションデフォルト値
xノイズ空間の x座標
yノイズ空間の y座標
zノイズ空間の z座標

戻値

パーリンノイズ値(0~1)

備考

関連

noiseSeed