Blocks?

CODE;

ArrayList<Agent> agents;
PImage pix;
PImage pix2;

float offset = 1;
float easing = 0.10;

void setup() {
size (600, 600, P3D);

pix = loadImage(“pix.jpg”);
pix2 = loadImage(“pix2.jpg”);
agents = new ArrayList();
for (int i = 0; i < 100; i++) {
agents.add(new Agent ());
}
}
void draw() {

loadPixels();

translate(2/width, 2/height);
rotateX(mouseY * 0.005);
//rotateY(mouseX * 0.005);
//fill(13,17,188);
//lines of longitude, latitude
sphereDetail(1,1);
box(3);

 

for ( int i = 0; i< width * height; i++) {
color myColor = color(random (255));
pixels[i] = myColor;
}
image(pix, 0, 0 );
float dx = (mouseX-pix.width/2) – offset;
// offset += dx * easing;
tint(150,150);
image(pix, offset ,7);

image(pix2, 0, 0);
float fx = (mouseX-pix2.height/2) – offset;
offset += dx * easing;
tint(150,150);
image(pix2, offset ,7);

updatePixels();
fill(255, 0, 0, 63);

for (int i = 0; i < agents.size (); i++) {
Agent myAgent= agents.get(i);
myAgent.display();
myAgent.update();

}
for (int i = 0; i < agents.size (); i++) {
for (int j = 0; j < i; j++) {
//inner loop so we do not repeat pair test
Agent myAgentA = agents.get(i);
Agent myAgentB = agents.get(j);
float myDist = dist(myAgentA.x, myAgentA.y, myAgentB.x, myAgentB.y);
if (myDist <65) {
float alpha = map(myDist, 150, 10, 10, 155);
//stroke (random(255),alpha);
//OR
stroke (random(15) , random(113), random(34), alpha); // green
stroke (random(113) , random(74), random(15), alpha); //brown
// stroke (random(232) , random(145), random(14), alpha);

//line( myAgentA.x, myAgentA.y, myAgentB.x, myAgentB.y);
strokeWeight(5); // Thicker

}
}
}
}
class Agent {
float x;
float y;
float noiseX;
float noiseY;
Agent() {
x = random(height);
y = random(width);
noiseX = random(350);
noiseY = random(350);
}

void display() {
noFill();
rect(x, y, 35, 35);
}
void update() {
x= width *noise (noiseX);
y = height *noise(noiseY);
noiseX += .004;
noiseY += .004;
}
}

 

11 copy

Screen Shot 2014-10-28 at 3.14.50 PM

 

IMG_2057

Leave a reply