/* foo! */ int a; class mover { float x,y; float dh,ds,db; float dx, dy, dtheta; mover(int _x, int _y, float _dh, float _ds, float _db) { x=_x; y=_y; dh=_dh; // DeltaHue ds=_ds; // DelatSaturation db=_db; // DeltaBrightnesss dx=random(2)-1; dy=random(2)-1; dtheta=(random(TWO_PI)-PI)/100; } void move() { // dtheta+=random(0.01)-0.005; float a,theta; a=sqrt((dx*dx)+(dy*dy)); a+=random(0.02)-0.01; theta=atan2(dy,dx); theta+=dtheta; dx=a*cos(theta); dy=a*sin(theta); /* dx=dx*cos(theta); dy=dy*sin(theta);*/ x+=dx; y+=dy; if(x>=width) x=0; if(x<0) x=width-1; if(y>=height) y=0; if(y<0) y=height-1; /* while(x<50) x+=100; while(x>=150) x-=100; while(y<50) y+=100; while(y>=150) y-=100;*/ } void draw() { color c=get((int)x,(int)y); float h,s,b; h=hue(c); s=saturation(c); b=brightness(c); h+=dh; if(h>360) h-=360; if(h<0) h+=360; s+=ds; b+=db; set((int)x,(int)y,color(h,s,b)); } } void blur(int tt) { for(int i=0;i<(width*height)/20;i++) { int x=(int)random(width-2)+1; int y=(int)random(height-2)+1; int dx=0,dy=0; if(random(2)<1) dx=1; else dy=-1; if(random(2)<1) dy=1; else dy=-1; int r=pixels[x+y*width]&255; int g=(pixels[x+y*width]>>8)&255; int b=(pixels[x+y*width]>>16)&255; r+=pixels[x+dx+(y+dy)*width]&255; g+=(pixels[x+dx+(y+dy)*width]>>8)&255; b+=(pixels[x+dx+(y+dy)*width]>>16)&255; r/=2; g/=2; b/=2; pixels[x+y*width]=r+(g<<8)+(b<<16); } } mover[] bob; void setup() { size(300,300); colorMode(HSB,360,100,100); background(180,0,50); bob=new mover[2000]; for(int i=0;i