10 iterations amp 1000 variation 2000
//================================================
macro "fun with randomish blobs [q]" {
newImage("blobalicious", "RGB White", 640,640, 1);
run("Colors...", "foreground=orange background=black selection=yellow");
run("Select All");
run("Fill", "slice");
amplitude = 300; // radius of a circle
variation = 600; // plus or minus variation of amplitude
number_of_points = 5 + round(random()*5.5); // min and max number of points
for (i=0; i<10; i++) {
draw_one_blob(number_of_points, variation, amplitude);
a = floor(random() * 256);
xxxxxxxx = toBinary(a);
run("XOR...", "value="+xxxxxxxx);
run("Select None");
}
}
//================================================
function draw_one_blob(points, variation, amp) {
xc = getWidth()/2; yc = getHeight()/2;
x = newArray(points);
y = newArray(points);
step = 2 * PI / points;
t = 0;
for (k=0; k<points; k++ ){
r = amp - variation + (random() * variation * 2);
x[k] = xc + r * sin(t);
y[k] = yc + r * cos(t);
t=t+step;
}
//x[points] = x[0];
//y[points] = y[0];
makeSelection("polygon", x, y);
run("Fit Spline");
}
10 iterations amp 1000 variation 2000
//================================================
macro "fun with randomish blobs [q]" {
newImage("blobalicious", "RGB White", 640,640, 1);
run("Colors...", "foreground=orange background=black selection=yellow");
run("Select All");
run("Fill", "slice");
amplitude = 300; // radius of a circle
variation = 600; // plus or minus variation of amplitude
number_of_points = 5 + round(random()*5.5); // min and max number of points
for (i=0; i<10; i++) {
draw_one_blob(number_of_points, variation, amplitude);
a = floor(random() * 256);
xxxxxxxx = toBinary(a);
run("XOR...", "value="+xxxxxxxx);
run("Select None");
}
}
//================================================
function draw_one_blob(points, variation, amp) {
xc = getWidth()/2; yc = getHeight()/2;
x = newArray(points);
y = newArray(points);
step = 2 * PI / points;
t = 0;
for (k=0; k<points; k++ ){
r = amp - variation + (random() * variation * 2);
x[k] = xc + r * sin(t);
y[k] = yc + r * cos(t);
t=t+step;
}
//x[points] = x[0];
//y[points] = y[0];
makeSelection("polygon", x, y);
run("Fit Spline");
}