2020-12-12から1日間の記事一覧

PerlinNoise

class PerlinNoise { constructor (random = Math.random) { this.random = random; this.gradient = new Map; } randomGradient (x) { if (! this.gradient.has (x)) this.gradient.set (x, this.random () * 2 -1); return this.gradient.get (x); } noise…