//***************************************************************************// // EXUVIA - an installation by Alessandro Capozzo and Katja Noppes // // Milano, September 2005 - Januray 2006 // // www.abstract-codex.net - www.katjanoppes.net // // Code by Alessandro Capozzo built with Processing Beta .91 // // www.processing.org // //***************************************************************************// Pix [] amountOfPix; int my_array_length; boolean mouseDown; float timeC=0; float midWidth; float midHeight; // put some blue dots on a picture :) PImage myImage = loadImage("/libmatrix4.jpg"); int automaNum; Automa [] cellularAutoma; void setup(){ size(1024,768,P3D); image(myImage,1,1); loadPixels(); automaNum=320; midWidth=width*.5; midHeight=height*.5; cellularAutoma=new Automa[automaNum]; for(int a=0; a2){ //stroke(redCoef,redCoef,blueCoef,60); stroke(255); if(amountOfPix[firstSeg].firstSeg!=ID&&amountOfPix[firstSeg].secondSeg!=ID||firstSeg>ID){ line(_pX,_pY,amountOfPix[firstSeg]._pX,amountOfPix[firstSeg]._pY); } if(amountOfPix[secondSeg].firstSeg!=ID&&amountOfPix[secondSeg].secondSeg!=ID||secondSeg>ID){ line(_pX,_pY,amountOfPix[secondSeg]._pX,amountOfPix[secondSeg]._pY); } gravity+=connected; connected=0; } stroke(redCoef,redCoef,blueCoef,100); setConnection(); } void newPosition(){ if(gravity>160){ //if(dist(_X,_Y,mouseX,mouseY)<80){ pixNoise=noise(_pX,_pY,timeC); _pX+=cos(atan2(_Y-midHeight,_X-midWidth))*((_X-(gravity)-_pX)*.1); _pY+=sin(atan2(_Y-midHeight,_X-midWidth))*((_X-(gravity)-_pX)*.1); /* _pX+=int((_X-(gravity)-_pX)*.1); _pY+=int((_Y-(gravity)-_pY)*.1); */ gravity=0; } else{ difX=_X-_pX; difY=_Y-_pY; xSpeed+=difX*ndelay; ySpeed+=difY*ndelay; xSpeed*=.9; ySpeed*=.9; _pX+=xSpeed; _pY+=ySpeed; } } void setConnection(){ float oldDist=width*height; float newDist=0; for(int k=0;k8)){ stroke(aColor); line(_x,_y,cellularAutoma[(int)_near]._x,cellularAutoma[(int)_near]._y); noFill(); ellipse(_x,_y,ceil(_dist),ceil(_dist)); fill(aColor);; ellipse(_x,_y,3,3); } else { fill(aColor); stroke(aColor); ellipse(_x,_y,3,3); } } void upDate(){ if(checkTarget){ oldDist=width*height; idTarget=-1; checkTarget=false; for(int k=0;k4){ speedX=4; } else if(speedX<-4){ speedX=-4; } if(speedY>4){ speedY=4; } else if(speedY<-4){ speedY=-4; } } } speedX=speedX+xJump; speedY=speedY+yJump; oldX=_x; oldY=_y; _x+=speedX; _y+=speedY; if(_x==oldX && _y==oldY){ stopCount++; if(stopCount>10){ reStart(_id); } } } } void reStart (int id){ cellularAutoma[id]=new Automa(id); }