Just added some color and depth and style to the normal proximity grid :). This is my last entry!
_root.createEmptyMovieClip("container",1);
var cam_z = 0;
var cam_x = 0;
var cam_y = 0;
var maxdepth = 100;
var HALF_WIDTH = 500/2;
var HALF_HEIGHT = 300/2;
var d = 1;
MovieClip.prototype.setHue = function(x, mc) {
//x = 0 - 1
x = Math.max(x*2*Math.PI, 0.01);
r = 128+128*Math.cos(x);
g = 128+128*Math.cos(x+Math.PI*2/3);
b = 128+128*Math.cos(x+Math.PI*4/3);
var hex = r << 16 | g << 8 | b;
this.filters=[new flash.filters.GlowFilter(hex,.8,20,20,2,2)];
this.colorobj.setRGB(hex);
return hex;
};
MovieClip.prototype.update3D = function() {
var normalizedz = 1-(this.z-cam_z)/maxdepth;
trace(normalizedz);
if (normalizedz <= 0) {
this._visible = false;
} else {
this._x = (this.x-cam_x)*normalizedz + HALF_WIDTH;
this._y = (this.y-cam_y)*normalizedz + HALF_HEIGHT;
this._xscale = this._yscale=50*(normalizedz);
this._visible = true;
this.swapDepths(normalizedz*10000);
this._alpha = this.alpha / 100 * (Math.max(0, maxdepth - Math.abs(this.z - cam_z)) / (maxdepth*0.5) * 100);
}
};
function addCircle(x,y,r){
var mc = container.attachMovie("circle","c"+d,d++);
mc.x=mc.x0=x;
mc.y=mc.y0=y;
mc.z=50;
mc.vx=mc.vy=0;
mc._width=mc._height=r*2;
mc.colorobj = new Color(mc.coloroverlay_mc);
var hex = mc.setHue(0);
mc.filters=[new flash.filters.GlowFilter(hex,.8,20,20,2,2)];
mc.update3D();
mc.blendMode = "add";
mc.onMouseMove=function(){
var dx = this.x0-_xmouse+250;
var dy = this.y0-_ymouse+150;
var d = Math.sqrt(dx*dx+dy*dy);
this.setHue(-d/400+1);
//this._xscale=this._yscale=50-d/5;
this.x=this.x0+dx/d*40;
this.y=this.y0+dy/d*40;
this.z=Math.min(50+(this.x0+(400-100)/30*this.y0)/3000,(d-50));
this.update3D();
}
}
for(var x =50;x<450;x+=50){
for(var y =70;y<250;y+=50){
addCircle(x-250,y-150,5);
}
}