// noise() (パーリンノイズ)の引数2つの場合のテスト // マウスカーソルのx,y座標でノイズの出方を変える PImage img; float nx, ny; void setup() { size(512, 512); img = createImage(width, height, RGB); frameRate(24); } void draw() { // background(0); nx = 1 + mouseX * 0.1; ny = 1 + mouseY * 0.1; img.loadPixels(); for (float y=0; y < height; y++) { for (float x=0; x < width; x++) { float px = (x / (width - 1)) * nx; float py = (y / (height - 1)) * ny; float c = 64 + noise(px, py) * (255 - 64); img.pixels[int(y * width + x)] = color(c); } } img.updatePixels(); image(img, 0, 0); textSize(16); text("sx:sy= " + str(nx) + " , " + str(ny), 10, 32); }