ArrayList<PVector> points;
float x0, y0, x, y, angle;
final float step = 1;
final float minDist = step / 6;
final float maxDist = 10;
void setup() {
size(900, 400);
background(70, random(50, 100), 100);
stroke(255, 255);
smooth();
points = new ArrayList<PVector>();
x0 = random(width);
y0 = 0;
angle = random(TWO_PI);
}
void draw() {
background(50, random(50, 100), 100);
x = (width + x0 + step * cos(angle)) % width;
y = (height + y0 + step * sin(angle)) % height;
PVector pt = new PVector(x, y);
for (PVector p : points) {
if (pt.dist(p) < minDist) {
pt = points.size() > 500 ? points.get(int(random(300))) : new PVector(random(width), 0);
break;
}
}
for (PVector p : points) {
if (pt.dist(p) < maxDist) {
line(p.x, p.y, pt.x, pt.y);
}
}
points.add(0, pt);
x0 = pt.x;
y0 = pt.y;
angle += random(-0.6, 0.6);
}
ArrayList<Brush> brushes;
void setup() {
size(500, 500);
background(255);
brushes = new ArrayList<Brush>();
for (int i = 0; i < 3; i++) { //tamaño de mancha
brushes.add(new Brush());
}
}
void draw() {
for (Brush brush : brushes) {
brush.paint();
}
}
void mouseClicked() {
setup();
}
class Brush {
float angle;
int components[];
float x, y;
color clr;
Brush() {
angle = random(TWO_PI);
x = random(width);
y = random(height);
clr = color(random(255), random(255), random(255), 5);
components = new int[2];
for (int i = 0; i < 1; i++) {
components[i] = int(random(1, 5));
}
}
void paint() {
float a = 0;
float r = 0;
float x1 = x;
float y1 = y;
float u = random(0.5, 1);
fill(clr);
noStroke();
beginShape();
while (a < TWO_PI) {
vertex(x1, y1);
float v = random(0.85, 1);
x1 = x + r * cos(angle + a) * u * v;
y1 = y + r * sin(angle + a) * u * v;
a += PI / 180;
for (int i = 0; i < 2; i++) {
r += sin(a * components[i]);
}
}
endShape(CLOSE);
if (x < 0 || x > width ||y < 0 || y > height) {
angle += HALF_PI;
}
x += 2 * cos(angle);
y += 2 * sin(angle);
angle += random(-0.15, 0.15);
}
}
float x0, y0, x, y, angle;
final float step = 1;
final float minDist = step / 6;
final float maxDist = 10;
void setup() {
size(900, 400);
background(70, random(50, 100), 100);
stroke(255, 255);
smooth();
points = new ArrayList<PVector>();
x0 = random(width);
y0 = 0;
angle = random(TWO_PI);
}
void draw() {
background(50, random(50, 100), 100);
x = (width + x0 + step * cos(angle)) % width;
y = (height + y0 + step * sin(angle)) % height;
PVector pt = new PVector(x, y);
for (PVector p : points) {
if (pt.dist(p) < minDist) {
pt = points.size() > 500 ? points.get(int(random(300))) : new PVector(random(width), 0);
break;
}
}
for (PVector p : points) {
if (pt.dist(p) < maxDist) {
line(p.x, p.y, pt.x, pt.y);
}
}
points.add(0, pt);
x0 = pt.x;
y0 = pt.y;
angle += random(-0.6, 0.6);
}
ArrayList<Brush> brushes;
void setup() {
size(500, 500);
background(255);
brushes = new ArrayList<Brush>();
for (int i = 0; i < 3; i++) { //tamaño de mancha
brushes.add(new Brush());
}
}
void draw() {
for (Brush brush : brushes) {
brush.paint();
}
}
void mouseClicked() {
setup();
}
class Brush {
float angle;
int components[];
float x, y;
color clr;
Brush() {
angle = random(TWO_PI);
x = random(width);
y = random(height);
clr = color(random(255), random(255), random(255), 5);
components = new int[2];
for (int i = 0; i < 1; i++) {
components[i] = int(random(1, 5));
}
}
void paint() {
float a = 0;
float r = 0;
float x1 = x;
float y1 = y;
float u = random(0.5, 1);
fill(clr);
noStroke();
beginShape();
while (a < TWO_PI) {
vertex(x1, y1);
float v = random(0.85, 1);
x1 = x + r * cos(angle + a) * u * v;
y1 = y + r * sin(angle + a) * u * v;
a += PI / 180;
for (int i = 0; i < 2; i++) {
r += sin(a * components[i]);
}
}
endShape(CLOSE);
if (x < 0 || x > width ||y < 0 || y > height) {
angle += HALF_PI;
}
x += 2 * cos(angle);
y += 2 * sin(angle);
angle += random(-0.15, 0.15);
}
}


Comentarios
Publicar un comentario