CircularNoise cNoise;
void setup(){
size(500, 500);
colorMode(HSB, 360, 100, 100);
stroke(330, 30, 70);
strokeWeight(2);
fill(90, 30, 70);
cNoise = new CircularNoise(0.8);
}
void draw(){
background(180, 30, 70);
translate(width / 2, height / 2);
beginShape();
for(float angle = 0; angle < 360; angle += 1.0){
float radian = radians(angle);
float radious = 150 + map(cNoise.getNoise(radian, frameCount * 0.02), 0, 1, -100, 100);
vertex(radious * cos(radian), radious * sin(radian));
}
endShape(CLOSE);
}
class CircularNoise{
float offsetX, offsetY, offsetZ;
float scale;
CircularNoise(float scale){
offsetX = random(100000);
offsetY = random(100000);
offsetZ = random(100000);
this.scale = scale;
}
float getNoise(float radian){
float r = radian % TWO_PI;
if(r < 0.0){r += TWO_PI;}
return noise(offsetX + cos(r) * scale, offsetY + sin(r) * scale);
}
float getNoise(float radian, float time){
float r = radian % TWO_PI;
if(r < 0.0){r += TWO_PI;}
return noise(offsetX + cos(r) * scale, offsetY + sin(r) * scale, offsetZ + time);
}
}