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
指定された座標でのパーリンノイズ値を返します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| x | ノイズ空間の x座標 | |||
| y | ノイズ空間の y座標 | ○ | ||
| z | ノイズ空間の z座標 | ○ |
パーリンノイズ値(0~1)