xxxxxxxxxx
45
let myScale = 0.01,
radius = 100.0,
nSteps = 360,
width = 150,
height = 150,
pixel_size = 1;
var currStep = 0;
function setup() {
createCanvas(width, height);
pixelDensity(4);
noStroke();
}
function noisy(x, y, theta) {
// noise(x,y) == noise(-x,y) --- so add offset of radius*5
var px = (radius*5) + (x + radius) * cos(theta);
var py = (radius*5) + (x + radius) * sin(theta);
return noise(myScale * px, myScale * py, myScale * y);
}
function draw() {
currStep = frameCount % nSteps;
var t = map(currStep, 0, nSteps, 0, TWO_PI);
for (var x = 0; x < width/pixel_size; x++) {
for (var y = 0; y < height/pixel_size; y++) {
if (noisy(x, y, t) > 0.5) {
fill(255);
} else {
fill(0);
}
rect(x * pixel_size, y * pixel_size, pixel_size, pixel_size);
}
}
if (frameCount <= nSteps) {
// saveCanvas("4x-" + nf(frameCount, 3) + ".png");
}
}