drawing basic circle
4.1 Dots Circle and circle
size(500, 300); background(255); strokeWeight(5); smooth();
float radius = 100; int centX = 250; int centY = 150;
stroke(0, 30); noFill(); ellipse(centX, centY, radius*2, radius*2);
stroke(20, 50, 70); float x,y; //float lastx = -999; //float lasty = -999; for(float ang=0; ang <=360; ang+=5){ float rad = radians(ang); x = centX + (radius*cos(rad)); y = centY + (radius*sin(rad)); point(x,y); }
4.2 Spiral Circle
size(500, 300); background(255); strokeWeight(5); smooth();
float radius = 100; int centX = 250; int centY = 150;
stroke(0, 30); noFill(); ellipse(centX, centY, radius*2, radius*2);
stroke(20, 50, 70); radius = 10; float x,y; float lastx = -999; float lasty = -999; for(float ang=0; ang<=1440; ang+=5){ //ang <= 1440は360*4で四回転分ということ radius += 0.5; float rad = radians(ang); x = centX + (radius*cos(rad)); y = centY + (radius*sin(rad)); if(lastx >-999){ line(x,y,lastx,lasty); } lastx = x; lasty = y; }
4.3 Noise Spirals
size(500, 300); background(255); strokeWeight(5); smooth();
float radius = 100; int centX = 250; int centY = 150;
stroke(0, 30); noFill(); ellipse(centX, centY, radius*2, radius*2);
stroke(20, 50, 70); radius = 10; float x,y; float lastx = -999; float lasty = -999;
float radiusNoise = random(10);
for(float ang=0; ang<=1440; ang+=5){ radiusNoise += 0.05; radius += 0.5; float thisRadius= radius + (noise(radiusNoise)*200)-100; //noise(radiusNoise)は0~1の範囲でそれを200倍して100引くから0~100の数字がランダムに生成されて、それをradiusに足し、thisRadiusに代入する。 float rad = radians(ang); x = centX + (thisRadius*cos(rad)); y = centY + (thisRadius*sin(rad)); if(lastx >-999){ line(x,y,lastx,lasty); } lastx = x; lasty = y; }
4.4 100 spirals, with noise
size(500, 300); background(255); strokeWeight(0.5); smooth();
int centX = 250; int centY = 150;
float x,y; for(int i=0; i<100; i++){ //(iを100回繰り返す。100回の描画) float lastx = -999; float lasty = -999; float radiusNoise = random(10); float radius = 10; stroke(random(20), random(50), random(70),80); int startangle = int(random(360)); int endangle = 1440 + int(random(1440)); int anglestep = 5 + int(random(3)); for(float ang = startangle; ang <= endangle; ang+=anglestep){ radiusNoise += 0.05; radius += 0.5; float thisRadius = radius + (noise(radiusNoise)*200)-100; float rad = radians(ang); x = centX + (thisRadius*cos(rad)); y = centY + (thisRadius*sin(rad)); if(lastx >-999){ line(x,y,lastx,lasty); } lastx = x; lasty = y; } }
4.5 a circle drawn with a custom noise function
(revising4.1code) void setup(){ size(500, 300); background(255); strokeWeight(5); smooth();
float radius = 100; //直径100 int centX = 250; //x軸位置 int centY = 150; //y軸位置
stroke(0, 30); noFill(); ellipse(centX, centY, radius*2, radius*2); //外の円を描画
stroke(20, 50, 70); strokeWeight(1);
float x, y; float noiseval = random(10); //randomize start point float radVariance, thisRadius, rad; beginShape(); //beginShapeとendShapeで繋がった線分(多角形)を描く fill(20, 50, 70, 50); for(float ang = 0; ang <= 360; ang += 1){ //360度ループ
noiseval += 0.1; radVariance = 30*customNoise(noiseval);
thisRadius = radius + radVariance; rad = radians(ang); x = centX + (thisRadius*cos(rad)); y = centY + (thisRadius*sin(rad));
curveVertex(x, y); } endShape(); }
float customNoise(float value){ float retValue = pow(sin(value), 3); return retValue; }
-Generative Art-








