What about this one (blackhole metaballs surrounded by metastars):
Code:/*
Metaball effect created by D.Juurlink
Date: 14-04-2010
*/
interface Metamorph
{
public int getSum(int x,int y);
public void move(int angle);
}
class Metaball implements Metamorph
{
private int _x,_y,_radius;
private int _sangle;
private int _fx,_fy;
private int _domx,_domy;
public Metaball(int x,int y,int radius)
{
_x=x;
_y=y;
_radius=radius;
_sangle=int(random(0,359));
_fx=int(random(1,4));
_fy=int(random(1,4));
_domx=w/2-_radius*2;
_domx-=int(random(0,w/2-_radius*2));
_domy=h/2-_radius*2;
_domy-=int(random(0,h/2-_radius*2));
}
public int getSum(int x,int y)
{
return int((_radius<<25)/(sqx[abs(x-_x)%w]+sqy[abs(y-_y)%h]+1));
}
public int getX(){return _x;}
public int getY(){return _y;}
public void move(int angle)
{
_x=(_domx*sintbl[((angle+_sangle)*_fx)%360])>>11;
_x+=w/2;
_y=(_domy*costbl[((angle+_sangle)*_fy)%360])>>11;
_y+=h/2;
}
}
class Metastar implements Metamorph
{
private int _x,_y,_radius;
private int _sangle;
private int _fx,_fy;
private int _domx,_domy;
public Metastar(int x,int y,int radius)
{
_x=x;
_y=y;
_radius=radius;
_sangle=int(random(0,359));
_fx=int(random(1,4));
_fy=int(random(1,4));
_domx=w/2-_radius*2;
_domy=h/2-_radius*2;
}
public int getSum(int x,int y)
{
return (_radius*100)/(abs(x-_x)+abs(y-_y)+1);
}
public int getX(){return _x;}
public int getY(){return _y;}
public void move(int angle)
{
_x=(_domx*sintbl[((angle+_sangle)*_fx)%360])>>11;
_x+=w/2;
_y=(_domy*costbl[((angle+_sangle)*_fy)%360])>>11;
_y+=h/2;
}
}
PImage buffer;
long[] sqx,sqy;
color[] palette;
int angle=0;
int w,h;
int[] sintbl,costbl;
Metamorph[] balls;
void setup()
{
w=640/4;
h=480/4;
size(w*4,h*4,P2D);
buffer=createImage(w,h,RGB);
sqx=new long[w];
sqy=new long[h];
for(int x=0;x<w;x++)
{
sqx[x]=int(sq(x)*4096);
}
for(int y=0;y<h;y++)
{
sqy[y]=int(sq(y)*4096);
}
palette=new color[256*3];
for(int i=0;i<256;i++)
{
palette[i]=color(0,0,i);
palette[i+256]=color(i,0,255);
palette[i+512]=color(255,i,255);
}
sintbl=new int[360];
costbl=new int[360];
for(int i=0;i<360;i++)
{
sintbl[i]=int(sin(radians(i))*2048);
costbl[i]=int(cos(radians(i))*2048);
}
balls=new Metamorph[50];
for(int i=0;i<10;i++)
{
balls[i]=new Metaball(int(random(0,w)),int(random(0,h)),int(random(2,5)));
}
for(int i=0;i<40;i++)
{
balls[i+10]=new Metastar(int(random(0,w)),int(random(0,h)),int(random(3,8)));
}
}
void draw()
{
renderBalls();
for(int i=0;i<balls.length;i++)
{
balls[i].move(angle);
}
angle++;
}
void renderBalls()
{
buffer.loadPixels();
for(int x=0;x<w;x++)
{
for(int y=0;y<h;y++)
{
int sum=0;
for(int i=0;i<balls.length;i++)
{
if(balls[i] instanceof Metastar)
sum+=balls[i].getSum(x,y);
else
sum-=balls[i].getSum(x,y);
}
buffer.pixels[y*w+x]=palette[constrain(sum,0,palette.length-1)];
}
}
buffer.updatePixels();
image(buffer,0,0,w*4,h*4);
}