int mx = 100; int my = 100; int nx = 200; int ny = 150; int r1 = 40; int r2 = 30; int r3 = 30; void setup() { size(300,300); frameRate(25); } void draw() { background(0); loadPixels(); for ( int y = 0; y < 300; y++ ) { for ( int x = 0; x < 300; x++ ) { int dx1 = x - mouseX; int dy1 = y - mouseY; int dx2 = x - mx; int dy2 = y - my; int dx3 = x - nx; int dy3 = y - ny; float d1 = dx1*dx1 + dy1*dy1; float d2 = dx2*dx2 + dy2*dy2; float d3 = dx3*dx3 + dy3*dy3; float f = fun( d1 / (r1*r1)) + fun( d2 / (r2*r2)) + fun(d3/(r3*r3)); if (f > 0.4 && f < 0.6 ) { int c = (int)( fun( 3200 * (f-.5) * (f-.5)) * 255 ); pixels[x + y * 300] = color(c); } } } updatePixels(); } float fun( float xsq ) { float f = 0; if ( xsq > -PI * 2 && xsq < PI * 2 ) { f = cos( xsq/2 ) * 0.5 + 0.5; } return f * f; }